<template>
	<view class="main-wrapper">
		<view v-if="templetName=='appsj_scan_single' && clientType=='pda'" style="position: absolute;top:0px;width: 100vw;background-color: #fff;">
			<input ref="input2" style="caret-color:#f00;height: 40px;border: 1px solid #333;margin: 0 5px;padding-left: 5px;"  maxlength="-1" v-model="inputVal"/>
		</view> 
		<view v-if="templetName=='appsj_scan_single'&& clientType=='WeChat'" style="position: absolute;top:0px;width: 100vw;background-color: #fff;display: flex;flex-direction: row;">
			<view style="text-align: right;width: calc(100vw - 30px);padding-top: 4px;height:60px;">
				<input style="height: 60px;width: 100%"  maxlength="-1" v-model="inputVal" @blur="inputblur($event)" />
			</view>
			<view  @click="navitoscan" class="iconfont icon-saomiao" style="color: #fd6137;padding: 5px; margin-right: 5px; font-size: 38px;display: flex;align-items: center;"></view>
		</view>
		
		<scroll-view :style="{'height':marginheight+'px','margin-top':templetName=='appsj_scan_single'? bottomcount+'px':'0px'}"  scroll-y="true" >
			<block>
				<view class="main-content">
				   <view class="content-item" 
						v-if="((JSON.stringify(divlist.divClass)!='{}'&&item.blockName!='' ) || JSON.stringify(divlist.divClass)=='{}') && templetName!='appsj_scan_single' " 
					    v-for="(item,index) in dataList[0]" 
					    :key="item.id">
						
						<view v-if="item.blockName=='detailhead_title_line1_col2'">
							<styleheadtitle
							 :data='item'
							 :clientType="clientType">
							</styleheadtitle>
						</view>
						<view v-else>
							<stylehead ref="stylehead"
								:bigdatalist ='dataList[0]'
								:divArea='item.divArea' 
								:data='item'
								:pageName='pageName'
								:index="index" 
								:isaddedit='isaddedit'
								:jsonoptions="jsonoptions"
								:clientType="clientType">
							</stylehead>
						</view>
				   </view>
				</view>
				
				<view class="main-content">
				   <view class="content-item" 
						v-if="((JSON.stringify(divlist.divClass)!='{}'&&item.blockName!='') || JSON.stringify(divlist.divClass)=='{}')  && templetName=='appsj_scan_single'"
					    v-for="(item,index) in dataList[0]" 
						:key="item.id">
						<stylehead2 ref="stylehead" 
							:bigdatalist ='dataList[0]'
							:divArea='item.divArea' 
							:data='item' 
							:pageName='pageName'
							:index="index" 
							:isaddedit='isaddedit'
							:jsonoptions="jsonoptions"
							 :clientType="clientType">
						</stylehead2>
				   </view>
				</view>
				
				<view class="main-content">
				    <view class="content-item"  
						v-for="(item,index) in datadetail" 
						:key="item[0].blockid" 
						v-if="datadetail[0] != undefined && item.blockName!='' && divdetail.divClass.className=='detail_detail' ">
						<styledetail2 ref="styledetail2"  
							:bigdatalist="item" 
							:headdatalist='dataList[0]'
							:divArea='item[0].divArea' 
							:data='item[0]' 
							:pageName='pageName'
							:listindex="index" 
							:jsonoptions="jsonoptions" 
							:detailbtns='detailbtns'
							:clientType="clientType">
						</styledetail2>
				    </view>
				</view>
				
				<view class="main-content">
				    <view class="content-item"  
					v-for="(item,index) in datadetail" 
					:key="item[0].blockid" 
					@click="detailitemclick(index)"
					v-if="datadetail[0] != undefined && item.blockName!='' && divdetail.divClass.className=='detail_scan' && divdetail.style.visible && item[0].isnewitem">
						<styledetail4 ref="styledetail4"  
							:bigdatalist="item" 
							:headdatalist='dataList[0]'
							:divArea='item[0].divArea' 
							:data='item[0]' 
							:listindex="index" 
							:isaddedit='isaddedit'
							:pageName='pageName'
							:jsonoptions="jsonoptions"
							:detailbtns='detailbtns'
							:clientType="clientType">
						</styledetail4>
				    </view>
				</view>
				
				<view class="main-content">
				    <view class="content-item"  
					v-for="(item,index) in datadetail" 
					:key="item[0].blockid" 
					v-if="datadetail[0] != undefined && item.blockName!='' && divdetail.divClass.className=='detail_imageproduct' && divdetail.style.visible">
						<styledetail3 ref="styledetail3"  
							:skuselected="skuselected" 
							:headdatalist='dataList[0]'
							:divArea='item[0].divArea' 
							:data='item' 
							:listindex="index" 
							:isaddedit='isaddedit'
							:jsonoptions="jsonoptions"
							:pic_address = "pic_address"
							:detailbtns='detailbtns'
							:clientType="clientType">
						</styledetail3>
				    </view>
				</view>
							
				<view class="main-content">
				    <view class="content-item" 
						v-if="colStyleSummary[0] != undefined && colStyleSummary[0].data!=undefined && JSON.stringify(colStyleSummary[0].data)!='[]' && divdetail.style.showSum">
						<styledetail2
							:bigdatalist="colStyleSummary" 
							:divArea='divArea' 
							:data='colStyleSummary[0]' 
							:pageName='pageName'
							:listindex="0" 
							:jsonoptions="jsonoptions"
							:clientType="clientType">
						</styledetail2>
				    </view>
				</view>
				
				<view class="main-content">
				    <view class="content-item" v-if="JSON.stringify(datapic) != '[]'">
						<billpic
							:data='datapic'
							:opttype='opttype'>
						</billpic>
				    </view>
				</view>
				
				<view class="main-content">
				   <view class="content-item" 
				   v-if="((JSON.stringify(divbottom.divClass)!='{}'&&item.blockName!='') || JSON.stringify(divbottom.divClass)=='{}') && divbottom.style.visible" 
					   v-for="(item,index) in databottom[0]" 
					   :key="item.id">
						<stylehead ref="stylehead" 
							:bigdatalist ='databottom[0]'
							:divArea='item.divArea' 
							:data='item' 
							:index="index" 
							:jsonoptions="jsonoptions" 
							:isaddedit='isaddedit'
							:clientType="clientType">
						</stylehead>
				   </view>
				</view>
				
				<view class="main-content">
				   <view class="content-item" 
						v-if="((JSON.stringify(divaudit.divClass)!='{}'&&item.blockName!='') || JSON.stringify(divaudit.divClass)=='{}') && divaudit.style.visible" 
					    v-for="(item,index) in dataaudit[0]" 
					    :key="item.id">
						<stylehead ref="stylehead" 
							:bigdatalist ='dataaudit[0]'
							:divArea='item.divArea' 
							:data='item' 
							:index="index" 
							:isaddedit='true'
							:jsonoptions="jsonoptions" >
						</stylehead>
				   </view>
				</view>
			</block>
		</scroll-view>
	
<!-- 原来的70px 现在是90px 当报错内容多会显示不下 -->
		<view v-if="JSON.stringify(btns)!='[]'" class="bottom-wrapper"   :style="{'height':isbottommsg?'70px':'40px','bottom':bottommargin?'32px':'0'}">
			<view v-if="btns.length!=1 " style="display: flex;flex-direction: row; height: 40px; ">
				<view @click="btnclick(index2)" v-for="(item2, index2) in btns" :key="index2"  style="height: 100%;display: flex;flex-direction: row;">
					<view :style="{'width':btnwidth+'vw', 'margin-left':btnpadding+'vw'}" style="align-items: center; display: flex;justify-content: center;height: 100%; background-color: #F55C23;color: #fff;">{{item2.text}}</view>
				</view>
			</view>
			<view v-else-if="btns.length==1" style="display: flex;flex-direction: row; height: 40px;margin-bottom: 10px;">
				<view @click="btnclick(0)"  style="margin-left: 5vw; width: 90vw; border-radius: 10px; align-items: center; display: flex; justify-content: center;height: 100%; background-color: #F55C23;color: #fff;">{{btns[0].text}}</view>
			</view>
			<view style='  width: 100vw;bottom: 0; display: flex;flex-direction: column;  justify-content: space-between;position: absolute;z-index:200;align-items: center;'>
				<view v-if="isbottommsg" style="height: 100%;align-items: center;display: flex;font-size: 20px;" >{{bottommsg}}</view>
			</view>
		</view>
		
		<view v-else class="bottom-wrapper2" :style="{'bottom':bottommargin?'32px':'0'}">
			<view v-if="isbottommsg" style="height: 100%;align-items: center;display: flex;font-size: 20px;" >{{bottommsg}}</view>
		</view>
		
		<view v-if="iscontentdetail1"  @click="closemask" style="backface-visibility: hidden;top: 0;right: 0;left: 0;bottom: 0;position: fixed;overflow: hidden;width: 100vw;height: 100%;opacity: 1;background-color: rgba(0,0,0,0.4);z-index: 9000;">
			<view @click.stop="" :style="{'height':maskheight+'px'}" style="opacity: 1;background-color: #fff;z-index: 9000;bottom: 0px;position: absolute;width: 100vw;">
				<stylesku ref="stylesku"  :isaddedit='isaddedit' :datalist='halfdatalist[0]'  :isdelete='true' :pagename='pageName' :pic_address='pic_address' :jsonoptions='jsonoptions' :divArea='halfdiv.divArea' :parenttype='parenttype'></stylesku>
			</view>
		</view>
		
		<view v-if="ismask" @click="closeprintmask" style="backface-visibility: hidden;top: 0;right: 0;left: 0;bottom: 0;position: fixed;overflow: hidden;width: 100%;height: 100%;opacity: 1;background-color: rgba(0,0,0,0.4);z-index: 900;">
			<view @click.stop="" :style="{'margin-top':layerheightmargin+'px','height':layerheight+'px'}" style="border-radius: 10px; margin-left: 15px; opacity: 1;width: calc(100vw - 30px);background-color: #fff;z-index: 900;">
				<view style="margin: 5px 0 ;overflow-y: scroll;overflow-x: hidden;height: 100%;position: relative;">
					<view  style="display: flex;flex-direction: column;padding: 0 20px;">
						<view style="display: flex;flex-direction: row;align-items: center;padding: 10px 0;">
							<view style="height: 10px;width: 3px;background-color: #F55C23;display: flex;margin-left: -20px;margin-right: 17px;"></view> 打印机列表
						</view>
						<view @click.stop="selectlayer(index2)" v-for="(item2, index2) in printlist" :key="index2" >
							<view style=" height: 1px;width: 100%;border-bottom: #f0f0f0 1px dashed;"></view>
							<view  style="padding: 10px 0; color: #666;font-size:20px; display: flex;flex-direction: row;justify-content: space-between;">
								<view :style="{'color':item2.isdefault == '1'?'#F55C23':'#666'}">{{item2.servicename}}--{{item2.logicalprinter}}</view>
							</view>
						</view> 
					</view>
				</view>
			</view>
		</view>
		
	</view>
</template>

<script>
	var util = require("../../utils/util.js");
	var processInitialData = require("../../utils/processInitialData.js")
	var common = require("../../utils/api/common.js")
	var infolistutil = require("../../utils/infolistutil.js");
	import logger from '../../utils/logger.js'
	import stylehead from "../../components/stylehead/stylehead"
	import styleheadtitle from "../../components/stylehead/styleheadtitle"
	import stylehead2 from "../../components/stylehead/stylehead2"
	import subtitle from "../../components/subtitle/subtitle"
	import stylecontent from "../../components/stylecontent/stylecontent"
	import styledetail2 from "../../components/styledetail/styledetail2"
	import styledetail3 from "../../components/styledetail/styledetail3"
	import styledetail4 from "../../components/styledetail/styledetail4"
	import billpic from "../../components/billpic/billpic"
	export default {
		components:{
			stylehead,
			styleheadtitle,
			stylehead2,
			subtitle,
			stylecontent,
			styledetail2,
			styledetail3,
			styledetail4,
			billpic
		},
		data() {
			return {
				isbottommsg:false,
				bottommsg:'',
				isNeedSave:false,
				isfocus:true,
				inputVal:'',
				page:{},
				iscontentdetail1:false,
				maskheight:370,
				halfdatalist:[],
				jsonoptions:{},
				
				dataList:[],
				olddatalist:[],
				olddatalisttemp:[],
				divlist:{},
				listblcokstyle:[],
				datadetail:[],
				olddatadetail:[],
				divdetail:{},
				datapic:[],
				olddatapic:[],
				divpic:{},
				databottom:[],
				olddatabottom:[],
				divbottom:{},
				dataaudit:[],
				olddataaudit:[],
				divaudit:{},
				skuselected:[],
				oldskuselected:[],
				detailblockstyle:[],
				detaildivarea:'',
				halfdiv:{},
				detailindex:0,
				colStyleSummary:[],
				precolStyleSummary:[],
				divprint:{},
				dataprint:[],
				printlist:[],
				ismask:false,
				layerheight:0,
				layerheightmargin:0,
				
				keyColumn:'',
				nameColumn: '',
				namesColumn: '',
				repeatByColName:'',
				repeatByColTag:'',
				
				bottomheadercount:{},
				operations:{},
				datagroup:[],
				contentdetail1:{},
				styletype:'',
				marginheight: '0px',
				bottomcount:60,//pda为40 小程序为60
				clientType:'',
				code:'',
				btnwidth:50,
				btnpadding:0,
				modcode:'',
				pageName:'',
				templetName:'',
				layercontent:{},
				detailbtns:[],
				pic_address:'',
				
				scanUArr:[],
				
				isrequest:true,
				optionsparam:{},
				customlist:[],
				opttype:'',
				modid:'',
				menuid:'',
				expArgs:[],
				headconditions:{},
				rtndatalist:{},
				// btns:[{ "name": "save","text": "保存", "type": "save","visible": true,"btnToDo": "save","clicked": {}}],
				btns:[],
				hidebtn:[],
				pageConditions : {'pageNumber':1,'rowsPerPage':20,'isAllData':false},
				isscan:false,
				times:'',
				interval:'',
				interval2:'',
				whenClosed:'',
				parentPage:{},
				bottommargin:false,
				main:'',
				receiver:''
			}
		},
		
		
		computed:{
			isaddedit(){
				var opttype = this.opttype
				var isstatus = true
				if(opttype!='billadd' && opttype != 'billedit'){
					isstatus = false
				}
				return isstatus
			},
			
			text(){
				var opttype = this.opttype
				var text = ''
				if(opttype=='billadd'){
					text = '确认保存'
				}else if(opttype == 'billedit'){
					text = '确认修改'
				}else if(opttype == 'billdelete'){
					text = '确认删除'
				}else if(opttype == 'billvoid'){
					text = '确认作废'
				}else if(opttype == 'billaudit'){
					text = '确认审核'
				}else if(opttype == 'billvoidaudit'){
					text = '取消审核'
				}else if(opttype == 'billcommand'){
					text = '确认执行'
				}else if(opttype == 'billprint'){
					text = '确认打印'
				}else if(opttype == 'billexport'){
					text = '确认导出'
				}else if(opttype == 'billview'){
					text = '返回'
					if(this.btns.length < 2 ){
						try{this.btns[0].btnToDo = 'closepage'}catch(e){}
					}
				}
				return text
			}
			
			
		},
		

		
		onLoad: async function(options) {
			var that = this;
			
			this.bottommargin = uni.getStorageSync('bottommargin')
			this.pic_address = getApp().globalData.pic_address
			that.optionsparam = options
			that.opttype = options.opttype
			that.parentPage = options.parentPage==undefined?'{}':options.parentPage
			that.whenClosed = options.whenClosed==undefined?'':options.whenClosed
			console.log('options', options)
			var opttype = that.opttype
			// that.btns[0].text = that.text 这个暂时先不要 因为会闪一下
			var productCode = uni.getStorageSync('productCode')
			var sessionId = uni.getStorageSync('sessionId')
			var projectCode = uni.getStorageSync('projectCode')
			var terminaltype = uni.getStorageSync('terminaltype')
			var dbId = uni.getStorageSync('dbId')
			var userId = uni.getStorageSync('userId')
			var userName = uni.getStorageSync('userName')
			var pageName = options.pagename
			var templetName = options.templatename
			var clientType = uni.getStorageSync('clientType')
			this.clientType= clientType
			
			var menuid = options.menuid
			var modid = options.modid
			var title = options.title==undefined?'':options.title
			let i18nArr = uni.getStorageSync('i18nArr')
			let i18n = uni.getStorageSync('i18n')
			if(i18n === 'en' && i18nArr!=undefined){
				title = that.$translg(title, i18nArr)
			}
			
			var expArgs = {}
			try{
				console.log('options.expArgs', JSON.parse(options.expArgs))
				expArgs = JSON.parse(options.expArgs)
			}catch(e){}
			
			
			
			console.log(expArgs)
			that.modid = modid
			that.menuid = menuid
			that.pageName = pageName
			that.templetName = templetName
			that.expArgs = expArgs
			var injson = common.requestStylePre(options)
			uni.showLoading({title: '加载中'})
			var url = getApp().globalData.app_address + '?method=saas_PageStyle&parse=json'
			const { data: res } = await infolistutil.post2(url, injson);
			var result = res;
			console.log(JSON.parse(JSON.stringify(result)))
			uni.hideLoading()
			that.page = result.data.page
			let page = result.data.page
			if (page.title!=='' && page.title!==undefined) title = page.title
			if(title!='')  uni.setNavigationBarTitle({title:title})
			
			if(templetName != 'appsj_scan_single'){
				if(result.data.btns.length > 0){
					var btns = result.data.btns
					var btns2 = []
					btns.forEach((val)=>{
						if(val.visible){
							btns2.push(val)
						}else{
							that.hidebtn.push(val)
						}
					})
					that.btns = btns2
					that.btnwidth =90 / btns2.length
					that.btnpadding = 10 / (btns2.length + 1)
				}else{
					var btns2 = [{ "name": "save","text": "保存","btnText": "保存", "type": "save","visible": true,"btnToDo": "save","clicked": {}}]
					btns2[0].text = that.text
					that.btns = btns2
					that.btnwidth =90 / btns2.length
					that.btnpadding = 10 / (btns2.length + 1)
				}
			}else{
				this.isbottommsg = true
				this.bottommsg = page.FirstMsgText
				if(result.data.btns.length > 0){
					var btns = result.data.btns
					var btns2 = []
					btns.forEach((val)=>{
						if(val.visible){
							btns2.push(val)
						}else{
							that.hidebtn.push(val)
						}
					})
					that.btns = btns2
					that.btnwidth =90 / btns2.length
					that.btnpadding = 10 / (btns2.length + 1)
				}else{
					var btns2 = [{ "name": "save","text": "保存","btnText": "保存", "type": "save","visible": true,"btnToDo": "save","clicked": {}}]
					btns2[0].text = that.text
					that.btns = btns2
					that.btnwidth =90 / btns2.length
					that.btnpadding = 10 / (btns2.length + 1)
				}
			}
			
			console.log('that.btns',that.btns)
			
			that.detailbtns = result.data.btns==undefined?[]:result.data.btns

			that.keyColumn= page.keyColumn?page.keyColumn:''
			that.nameColumn= page.nameColumn?page.nameColumn:''
			that.namesColumn= page.namesColumn?page.namesColumn:''
			//这个是为了infolist刷新用的或者提交后获取head区块内容
			var isGetHeadDataAfterCommit = page.isGetHeadDataAfterCommit!=undefined?page.isGetHeadDataAfterCommit:false
			that.isGetHeadDataAfterCommit = isGetHeadDataAfterCommit
			
			var div = result.data.div
			that.div = div
			uni.hideLoading()
			for (var index = 0;index < div.length;index++) {
				let val = div[index]
				
			
				// div.forEach((val, index)=>{
				if(i18n === 'en' && i18nArr!=undefined){
					val.style.colStyle.forEach((colVal)=>{
						if(colVal.style.colVisible){
							colVal.style.colText = that.$translg(colVal.style.colText,i18nArr)
						}
					})
				}
				var divArea = val.divArea
				if(opttype=='billadd'){
					val['type'] = 'insert'
				}else if(opttype == 'billdelete'){
					val['type'] = 'delete'
				}else{
					val['type'] = 'update'
				}
				
				if(divArea === 'dw_mx_head'){
					that.divlist = val
					options['divArea'] = divArea
					that.jsonoptions = options
				}else if(divArea === 'dw_mx_detail'){
					that.divdetail = val
					that.colStyleSummary = val.style.colStyleInSummary
					that.precolStyleSummary = JSON.parse(JSON.stringify(that.colStyleSummary))
					that.pageConditions.showRows =(val.style.showRows===undefined||val.style.showRows===0)?20:val.style.showRows
					that.pageConditions.isAllData = false
				}else if(divArea === 'dw_mx_pic'){
					that.divpic = val
				}else if(divArea === 'dw_mx_bottom'){
					that.divbottom = val
				}else if(divArea === 'dw_mx_audit'){
					that.divaudit = val
				}else if(divArea == 'dw_mx_print'){
					that.divprint = val
				}
				var datastyle = JSON.parse(JSON.stringify(val.style.colStyle))
				// uni.setStorageSync('ckdm','101') //测试用
				if(that.opttype == 'billadd' ){
					if(val.style.initialValues != undefined){
						var initialValues = val.style.initialValues
						console.log('initialValues',JSON.parse(JSON.stringify(initialValues)))
						var colStyle = processInitialData.initialstyletrans(datastyle, initialValues,expArgs)
						datastyle = colStyle
					}
					
					datastyle = await infolistutil.billaddinitaldatastyle(datastyle,util,options,divArea,that)
				}
				
				var divBlocks = val.divClass.divBlocks
				
				if(JSON.stringify(datastyle)!='[]'){
					var listindex = 0
					for(var i=0;i<datastyle.length;i++){
						if(datastyle[i].style.editStyle=='dddw' && datastyle[i].style.dddw.name!='d_nvo_uipage_dwc'&&datastyle[i].style.colVisible){
							datastyle[i].style['typeindex'] = listindex
							listindex++
							var multiselect = util.gettagvalue(datastyle[i].style.tag, 'multiselect')
							if(multiselect == 1){
								that.repeatByColName = datastyle[i].name
								that.repeatByColTag = datastyle[i].style.tag
							}
						}
					}
				}
			
				var temconditions = {}
				var conditions = val.style.conditions
				if(val.style.conditions != undefined){
					console.log('conditions', JSON.parse(JSON.stringify(val.style.conditions)),JSON.parse(JSON.stringify(expArgs)))
					if(JSON.stringify(expArgs) != '[]' && JSON.stringify(conditions) != '[]' && JSON.stringify(conditions) != undefined){
						var temobj = {}
						for(var m=0; m<conditions.length; m++){
							for(var n=0; n<expArgs.length; n++){
								if(conditions[m].divArea == expArgs[n].divArea){
									var foreignKeyArr = conditions[m].foreignKeyArr
									foreignKeyArr.forEach((val)=>{
										if(expArgs[n].colName == val.baseKey){
											temobj[val.foreignKey] = expArgs[n].value
										}
										if(val.type === 'value'){
											temobj[val.foreignKey] = val.value
										}
									})
									
								}
							}
						}
						temconditions[divArea] = temobj
						// if(JSON.stringify(temobj) != '{}' && that.opttype == 'billadd'){
						if( that.opttype == 'billadd'){
							for(var kk=0;kk<datastyle.length;kk++){
								for(var mm=0; mm<expArgs.length; mm++){
									if(datastyle[kk].name == expArgs[mm].colName){
										console.log(expArgs[mm].colName)
										datastyle[kk].style['colValue'] = expArgs[mm].value
										datastyle[kk].style.ismodified = true
										datastyle[kk].style['value'] = expArgs[mm].value
									}
								}
							}
						}
					}
				}
				
				
				var blockstyle = []
				blockstyle = infolistutil.divblocktrans(divBlocks, datastyle)
				
				
				if(that.opttype != 'billadd'){
					var dataObject = val.style.dataObject
					that.dataObject = dataObject
					
					var replaceConditions = {}
					var divreplaceColumns = val.style.replaceColumns==undefined?[]:val.style.replaceColumns
					replaceConditions = processInitialData.replaceConditionstrans(replaceConditions, divreplaceColumns,'','')
					
					var injson2 = common.requestDataPre(options, divArea, dataObject, replaceConditions, temconditions, that.pageConditions)
					console.log('injson2' + injson2)
					if(isGetHeadDataAfterCommit) that.headconditions = injson2
					
					var url = getApp().globalData.app_address + '?method=saas_PageDivData&parse=json'
					if(divArea != 'dw_mx_print'){
						that.$options.methods.getdatalist(url, injson2, blockstyle, divArea, val.type, that)
					}
				}else{
					
					var datalist = []
					var listtemp = []
					blockstyle.forEach((val2, index2) => {
						var style = val2.style
						var obj = {}
						if(divArea == 'dw_mx_detail'){
							obj['opttype'] = ''
						}else{
							obj['opttype'] = 'insert'
						}
						
						obj['divArea'] = divArea
						obj['property'] = val2.property
						obj['blockName'] = val2.blockName
						obj['id'] = index2
						obj['data'] = JSON.parse(JSON.stringify(style))
						listtemp.push(JSON.parse(JSON.stringify(obj)))
					})
					datalist.push(listtemp)
					if(divArea == 'dw_mx_head'){
						that.dataList = datalist
						that.olddatalist = JSON.parse(JSON.stringify(datalist))
						console.log(JSON.parse(JSON.stringify(that.dataList)))
						that.listblcokstyle = blockstyle
					}else if(divArea == 'dw_mx_detail'){
						that.datadetail = datalist
						that.olddatadetail = JSON.parse(JSON.stringify(datalist))
						console.log( JSON.parse(JSON.stringify(datalist)))
						that.detailblockstyle =  blockstyle
					}else if(divArea == 'dw_mx_pic'){
						that.datapic = datalist
						that.olddatapic = JSON.parse(JSON.stringify(datalist))
					}else if(divArea == 'dw_mx_bottom'){
						that.databottom = datalist
						that.olddatabottom = JSON.parse(JSON.stringify(datalist))
					}
				}
			// })
			
			}
			wx.getSystemInfo({
				success: function(res) {
					let clientHeight = res.windowHeight;
					let tempbottomcount = 0
					if(that.templetName === 'appsj_scan_single'){
						tempbottomcount = 80
					}else{
						tempbottomcount = 40
					}
					var bottomcount = JSON.stringify(that.btns)!='{}' ? tempbottomcount : 0
					if(this.bottommargin) bottomcount += 40
					if(templetName == 'appsj_scan_single'){
						bottomcount += that.bottomcount
					}
					that.marginheight = clientHeight - bottomcount
					console.log('marginheight'+ that.marginheight)
				}
			})
			
			
			uni.$on("updatelist",async (listtype, listindex,listblockindex, listitemindex, itemobj,pagename)=>{
				console.log(pagename)
				console.log(this.pageName)
				if(pagename!= this.pageName)return
				if(listtype === 'dw_mx_head'){
					var item = that.dataList[listindex][listblockindex].data[listitemindex]
					var tag = item.style.tag
					var prevalue = item.style.value==undefined?'':item.style.value
					
					if(tag.indexOf('scan')!=-1){
						that.isscan = true
						var scanValue = itemobj.value
						if(scanValue === '')return
						try{
							var scanObj = JSON.parse(scanValue)
							if(JSON.stringify(scanObj).indexOf('{')==-1){
								throw Error('扫描数据出错')
							}
							
							if(scanObj['送货单号']!=undefined){
								scanObj['单据号'] = scanObj['送货单号']
								scanObj['单据类型'] = '采购送货单'
							}
							
							console.log(scanObj)
							
							var divlist = that.divlist
							var scanColArr = divlist.style.scanColArr===undefined?[]:divlist.style.scanColArr
							var expArgs = that.expArgs
							for(var k=0; k<scanColArr.length; k++){
								var val = scanColArr[k]
								if(val.resetType == 'onlyone' && prevalue!=''){
									throw Error('不能多次扫描')
									return
								}
								
								if(val.colName == item.name){
									
									var noRowText = val.noRowText
									var checkBeforeDo = val.checkBeforeDo
									var headdata = JSON.parse(JSON.stringify(that.dataList[listindex])) 
									var parseQR = val.parseQR
									var hvaluepre = ''
									parseQR.forEach((pval)=>{
										headdata.forEach((hval)=>{
											hval.data.forEach((hval2)=>{
												if(pval.colName == hval2.name){
													hvaluepre = scanObj[pval.scanKey]==undefined?'':scanObj[pval.scanKey]
													if(hvaluepre!=''){
														hval2.style.colValue =hvaluepre
														hval2.style.value =hvaluepre
														hval2.style.coldisplay =hvaluepre
													}
												}
											})
										})
									})
									if(hvaluepre==''){
										throw Error('条码不正确!')
										return
									}
									console.log(JSON.parse(JSON.stringify(headdata)))
									
									var checkArgsIsEqual = val.checkArgsIsEqual
									checkArgsIsEqual.forEach((val2)=>{
										expArgs.forEach((val3)=>{
											if(val3.colName == val2.argKey){
												if(scanObj[val2.scanKey] != val3.value && scanObj[val2.scanKey]!=''){
													throw Error(val.msgText)
													return
												}
											}
										})
										
									})
									
									var scanUnique = val.scanUnique
									that.scanUAssi(scanUnique,headdata,true)
									that.dataList[listindex] = headdata
									
									var showValue = scanObj[val.scanShowKey]
									itemobj.colValue =showValue
									itemobj.value =showValue
									itemobj.coldisplay =showValue
									
									if(val.resetType == "reset" && showValue!=''){
										that.datadetail = that.olddatadetail
										that.scanUArr = []
										return
									}
									if(val.resetType=="replace" && showValue!=''){
										var ddre = JSON.parse(JSON.stringify(that.datadetail))
										ddre.forEach((vdd)=>{
											vdd.forEach((vdd3)=>{
												vdd3.data.forEach((vdd2)=>{
													if(vdd2.name == val.colName){
														vdd2.style.colValue =showValue
														vdd2.style.value =showValue
														vdd2.style.coldisplay =showValue
													}
												})
											})
											
										})
										that.datadetail = ddre
										that.$forceUpdate()
									}
									
									if(val.isNeedGetData){
									
										var tempconditons = {}
										var conObj = {}
										var conditons = divlist.style.conditions===undefined?[]:divlist.style.conditions
										console.log(conditons)
										conditons.forEach((val)=>{
											if(val.pageFrom =='parent'){
												var foreignKeyArr = val.foreignKeyArr
												foreignKeyArr.forEach((val2)=>{
													expArgs.forEach((val3)=>{
														if(val2.baseKey == val3.colName){
															conObj[val2.foreignKey] = val3.value
														}
													})
												})
											}else if(val.pageFrom == 'this'){
												var foreignKeyArr = val.foreignKeyArr
												foreignKeyArr.forEach((val2)=>{
													headdata.forEach((hval)=>{
														hval.data.forEach((hval2)=>{
															if(val2.baseKey == hval2.name){
																conObj[val2.foreignKey] = hval2.style.colValue
															}
														})
													})
												})
											}
										})
										tempconditons[divlist.divArea] = conObj
										var replaceConditions = {}
										var divreplaceColumns = divlist.style.replaceColumns==undefined?[]:divlist.style.replaceColumns
										replaceConditions = processInitialData.replaceConditionstrans(replaceConditions, divreplaceColumns,'','')
										var pageConditions = that.pageConditions
										pageConditions.isAllData = true
										var injson2 = common.requestDataPre(that.jsonoptions, divlist.divArea, divlist.style.dataObject, replaceConditions, tempconditons, pageConditions)
										console.log('injson2')
										console.log(injson2)
										var url = getApp().globalData.app_address + '?method=saas_PageDivData&parse=json'
										const { data: res } = await infolistutil.post2(url, injson2);
										console.log(res)
										var datalisttemp = res.data.div.value
										
										if(JSON.stringify(datalisttemp) != '[]'){
											
											if(JSON.stringify(checkBeforeDo)!='{}' && checkBeforeDo!=undefined){
												var MsgText = checkBeforeDo.msgText
												var checkArr = checkBeforeDo.checkArr
												var userConfirmed = true
												var checkColName= checkBeforeDo.colName
												headdata.forEach((hval)=>{
													hval.data.forEach((hval2)=>{
														if(checkColName == hval2.name){
															checkBeforeDo.colValue = hval2.style.colValue
														}
													})
												})
												if(MsgText != ''){
													if(MsgText.indexOf('#'+checkColName+'#')!=-1){
														MsgText = MsgText.replace('#'+checkColName+'#', checkBeforeDo.colValue)
													}
													userConfirmed = await that.showModalAndWait(MsgText);
												}
												
												if (userConfirmed) {
													if(JSON.stringify(checkArr)!='[]'){
														var injsoncheck = common.requestCheckData(that.jsonoptions, divlist.divArea, divlist.style.dataObject, datalisttemp, checkBeforeDo)
														var url = getApp().globalData.app_address + '?method=saas_PageCheckBeforeEvent&parse=json'
														const { data: rescheck } = await infolistutil.post2(url, injsoncheck);
														console.log(rescheck)
														if(rescheck.rtn == 1){
															if(!rescheck.data.allowToPass){
																that.scanUAssi(scanUnique,headdata,false)
																throw Error(rescheck.data.msgText)
																return
															}
														}
														
													}
												} else {
													that.scanUAssi(scanUnique,headdata,false)
													throw Error('')
													return
												}
											}
											that.scanResAssi(scanColArr,headdata,datalisttemp,divlist)
										}else{
											uni.showModal({
												title: '提示',
												content:noRowText,
												showCancel:false
											})
										}
									}
								}
							}
						}catch(e){
							console.log(e.message)
							if(e.message!=''){
								uni.showModal({
									title: '提示',
									content:e.message,
									showCancel:false
								})
							}
							itemobj.colValue = prevalue
							itemobj.value = prevalue
							itemobj.coldisplay = prevalue
						}
					}
					
					item.style = itemobj
					if(itemobj.itemchanged !=undefined && itemobj.itemchanged!= ''){
						var content = itemobj.itemcontent
						var itemchanged = itemobj.itemchanged
						var dddwcolumn = ''
						var itemcolumn = ''
						if(itemchanged!=undefined || itemchanged!= ''){
							dddwcolumn = itemchanged.split('.')[1]
							itemcolumn = itemchanged.split('@')[0]
						}
						for(var i=0;i<content.length;i++){
							if(dddwcolumn != '' && dddwcolumn == content[i].name){
								var dataList = that.dataList[listindex]
								dataList.forEach((val) => {
									val.data.forEach((val2, index2, origin) => {
										if(val2.name == itemcolumn){
											if(index2 == 0){console.log(origin)}
											origin[index2].style.value = content[i].style.value
											origin[index2].style.colValue = content[i].style.value
											origin[index2].style.coldisplay = content[i].style.value
											origin[index2].style.ismodified = true
										}
									})
								})
								that.dataList[listindex] = dataList
							}
						}
					}
					that.dataList[listindex][listblockindex].data[listitemindex] = JSON.parse(JSON.stringify(item))
					
					if(that.templetName == 'appsj_scan_single'){
						var colName = item.name
						var datadetail = that.datadetail
						var aValue = itemobj.value
						
						datadetail.forEach((dVal)=>{
							dVal.forEach((ddVal)=>{
								ddVal.data.forEach((dataVal)=>{
									if(colName == dataVal.name){
										dataVal.style.colValue =aValue
										dataVal.style.value =aValue
										dataVal.style.coldisplay =aValue
									}
								})
							})
						})
						that.datadetail = datadetail
					}
					that.$forceUpdate()
				}else if(listtype === 'dw_mx_detail'){
					var item = that.datadetail[listindex][listblockindex].data[listitemindex]
					item.style = itemobj
					if(itemobj.itemchanged !=undefined && itemobj.itemchanged!= ''){
						var content = itemobj.itemcontent
						var itemchangedall = itemobj.itemchanged
						var changedsemi = itemchangedall.split(',')
						changedsemi.forEach((itemchanged)=>{
							var dddwcolumn = ''
							var itemcolumn = ''
							if(itemchanged!=undefined || itemchanged!= ''){
								dddwcolumn = itemchanged.split('.')[1]
								itemcolumn = itemchanged.split('@')[0]
							}
							for(var i=0;i<content.length;i++){
								if(dddwcolumn != '' && dddwcolumn == content[i].name){
									var dataList = that.datadetail[listindex]
									dataList.forEach((val) => {
										val.data.forEach((val2, index2, origin) => {
											if(val2.name == itemcolumn){
												if(index2 == 0){console.log(origin)}
												origin[index2].style.value = content[i].style.value
												origin[index2].style.colValue = content[i].style.value
												origin[index2].style.coldisplay = content[i].style.value
												origin[index2].style.ismodified = true
											}
										})
									})
									that.datadetail[listindex] = dataList
								}
							}
						})
					}
					that.datadetail[listindex][listblockindex].data[listitemindex] = item
				}else if(listtype === 'dw_mx_bottom'){
					var item = that.databottom[listindex][listblockindex].data[listitemindex]
					item.style = itemobj
					if(itemobj.itemchanged !=undefined && itemobj.itemchanged!= ''){
						var content = itemobj.itemcontent
						var itemchanged = itemobj.itemchanged
						var dddwcolumn = ''
						var itemcolumn = ''
						if(itemchanged!=undefined || itemchanged!= ''){
							dddwcolumn = itemchanged.split('.')[1]
							itemcolumn = itemchanged.split('@')[0]
						}
						for(var i=0;i<content.length;i++){
							if(dddwcolumn != '' && dddwcolumn == content[i].name){
								var dataList = that.databottom[listindex]
								dataList.forEach((val) => {
									val.data.forEach((val2, index2, origin) => {
										if(val2.name == itemcolumn){
											if(index2 == 0){console.log(origin)}
											origin[index2].style.value = content[i].style.value
											origin[index2].style.colValue = content[i].style.value
											origin[index2].style.coldisplay = content[i].style.value
											origin[index2].style.ismodified = true
										}
									})
								})
								that.databottom[listindex] = dataList
							}
						}
					}
					
					that.databottom[listindex][listblockindex].data[listitemindex] = item
				}else if(listtype=='dw_datalist'){
					var item = that.halfdatalist[0][listblockindex].data[listitemindex]
					item.style = itemobj
					if(itemobj.itemchanged !=undefined && itemobj.itemchanged!= ''){
						var content = itemobj.itemcontent
						var itemchanged = itemobj.itemchanged
						var dddwcolumn = ''
						var itemcolumn = ''
						if(itemchanged!=undefined || itemchanged!= ''){
							dddwcolumn = itemchanged.split('.')[1]
							itemcolumn = itemchanged.split('@')[0]
						}
						for(var i=0;i<content.length;i++){
							if(dddwcolumn != '' && dddwcolumn == content[i].name){
								var dataList = that.halfdatalist[listindex]
								dataList.forEach((val) => {
									val.data.forEach((val2, index2, origin) => {
										if(val2.name == itemcolumn){
											if(index2 == 0){console.log(origin)}
											origin[index2].style.value = content[i].style.value
											origin[index2].style.colValue = content[i].style.value
											origin[index2].style.coldisplay = content[i].style.value
											origin[index2].style.ismodified = true
										}
									})
								})
								that.halfdatalist[listindex] = dataList
							}
						}
					}
					
					that.halfdatalist[0][listblockindex].data[listitemindex] = item
					var itemexpstr = util.gettagvalue(itemobj.tag,'computelist')
					if(itemexpstr!=''){
						itemexpstr = itemexpstr.replace(/'/g, '"').toString()
						var itemexp = JSON.parse(itemexpstr)
						var halfdatalist = that.halfdatalist[0]
						var skuitemdata = {}
						halfdatalist.forEach((val)=>{
							val.data.forEach((val2)=>{
								skuitemdata[val2.name] = val2.style.colValue
							})
						})
						itemexp.forEach((val)=>{
							halfdatalist.forEach((val2,index2)=>{
								val2.data.forEach((val3,index3)=>{
									if(val3.name == val){
										var ss = val3.style.expression
										var search = '#'
										var positions = []
										var index = ss.indexOf(search)
										var num = 0
										while(index !== -1){
											positions.push(index)
											index = ss.indexOf(search, index+1)
										}
										var ps = []
										for (var i = 0; i < positions.length; i++) {
											if(i%2 == 0){
												var c = ss.substring(positions[i]+1, positions[i+1])
												ps.push(['#'+c+'#', skuitemdata[c]])
											}
										}
										ps.forEach((valps)=>{
											console.log(valps)
											ss= ss.replace(valps[0], valps[1])
										})
										var productCode = uni.getStorageSync('productCode')
										var sessionId = uni.getStorageSync('sessionId')
										var projectCode = uni.getStorageSync('projectCode')
										var terminaltype = uni.getStorageSync('terminaltype')
										var dbId = uni.getStorageSync('dbId')
										var userId = uni.getStorageSync('userId')
										var userName = uni.getStorageSync('userName')
										var injson2 = '{"productCode":"' + productCode + '","terminalType":"' + terminaltype + '","projectCode":"' +
											projectCode + '","dbId":"' + dbId + '","templetName":"' + that.templetName + '","pageName":"' + that.pageName +
											'","menuId":"'+that.menuid+'","modId":"' + that.modid + '","sessionId":"' + sessionId + '","userId":"' + userId +
											'","userName":"' + userName + '","divArea":"' + that.divdetail.divArea + '","dataObject":"' + that.divdetail.style.dataObject + 
											'","colNameInput":"' + item.name + 
											'","colNameExp":"' + val + 
											'","expression":"' + ss + '"}';
										uni.request({
											url: getApp().globalData.app_address + '?method=saas_PageDivExpression&parse=json',
											data: injson2,
											method: 'POST',
											header: {'content-type': 'application/x-www-form-urlencoded'},
											success: function(res) {
												var result = res.data;
												var calcres = result.data
												val3.style.colValue = calcres
												val3.style.value = calcres
												val3.style.coldisplay = calcres
												val3.style.ismodified = true
												that.halfdatalist[0][index2].data[index3] = val3
												var itemchanged = util.gettagvalue(itemobj.tag,'itemchanged')
												var itemchangedarr = []
												if(itemchanged.indexOf(',')!=-1){
													itemchangedarr = itemchanged.split(',')
												}else{
													itemchangedarr.push(itemchanged)
												}
												itemchangedarr.forEach((valitem)=>{
													var valitemarr = valitem.split('=')
													if(valitem.indexOf(val3.name)!=-1){
														halfdatalist.forEach((val22,index22)=>{
															val22.data.forEach((val33,index33)=>{
																if(val33.name == valitemarr[0]){
																	val33.style.colValue = calcres
																	val33.style.value = calcres
																	val33.style.coldisplay = calcres
																	val33.style.ismodified = true
																	that.halfdatalist[0][index22].data[index33] = val33
																}
															})
														})
													}
												})
												
												that.$forceUpdate()
											},
										})
									}
								})
							})
						})
					}
				}

			})
			
			uni.$on("isExpand",(listtype, listindex,listblockindex,isExpand)=>{
				if(listtype === 'dw_mx_head'){
					that.dataList[listindex][listblockindex].property.isExpand = isExpand
				}
			})
			
			uni.$on("detailAddminus", (listtype, listindex, opttype, itemobj) =>{
				var that = this
				if(listtype === 'dw_mx_detail'){
					if(opttype === 'insert'){
						var datadetail = that.datadetail
						var detailsize = datadetail.length
						itemobj.forEach((val)=>{
							val.blockid = detailsize
						})
						datadetail.splice(listindex, 0, itemobj)
						that.datadetail = datadetail
					}else if(opttype === 'delete'){
						
						
						that.datadetail[listindex] = itemobj
						that.$forceUpdate()
						console.log(that.datadetail)
					}
				}
			})
			
			uni.$on("updatedatapic", (index, itemobj)=>{
				var that = this
				that.datapic[index] = itemobj
				that.$forceUpdate()
			})
			
			uni.$on("updatealldatapic", (itemobj)=>{
				var that = this
				that.datapic = itemobj
				that.$forceUpdate()
			})
			
			uni.$on("openhalfpage",(data,productindex)=>{
				var divdetail = this.divdetail
				this.detailindex = productindex
				var rowClick = divdetail.style.rowClick
				var pageName = rowClick.pageName
				var templetName = rowClick.templetName
				var expArgs = rowClick.expArgs
				if(JSON.stringify(expArgs)!='[]'){
					expArgs.forEach((val)=>{
						data.forEach((val2)=>{
							val2.data.forEach((val3)=>{
								if(val3.name == val.colName){
									val['value'] = val3.style.colValue
								}
							})
						})
					})
				}
				var productCode = uni.getStorageSync('productCode')
				var sessionId = uni.getStorageSync('sessionId')
				var projectCode = uni.getStorageSync('projectCode')
				var terminaltype = uni.getStorageSync('terminaltype')
				var dbId = uni.getStorageSync('dbId')
				var userId = uni.getStorageSync('userId')
				var userName = uni.getStorageSync('userName')
				
				var injson = '{"productCode":"' + productCode + '","terminalType":"' + terminaltype + '","projectCode":"' +
					projectCode + '","dbId":"' + dbId + '","templetName":"' + templetName + '","pageName":"' + pageName +
					'","menuId":"'+that.menuid+'","modId":"' + that.modid + '","sessionId":"' + sessionId + '","userId":"' + userId +
					'","userName":"' + userName + '"}';
				console.log(injson)
				
				uni.showLoading({ title: '加载中' })
				uni.request({
					url: getApp().globalData.app_address + '?method=saas_PageStyle&parse=json',
					data: injson,
					method: 'POST',
					header: {
						'content-type': 'application/x-www-form-urlencoded'
					},
					success: function(res) {
						var result = res.data;
						console.log(JSON.parse(JSON.stringify(result)))
						uni.hideLoading()
						var div = result.data.div[0]
						that.halfdiv = div
						var datastyle = div.style.colStyle
						var divBlocks = div.divClass.divBlocks
						var divArea = div.divArea
						that.ColNameQty = div.style.ColNameQty
						that.colNameWriteBackBasedOn = div.style.colNameWriteBackBasedOn
						
						
						if(JSON.stringify(datastyle)!='[]'){
							var listindex = 0
							for(var i=0;i<datastyle.length;i++){
								if(datastyle[i].style.editStyle=='dddw' && datastyle[i].style.dddw.name!='d_nvo_uipage_dwc'&&datastyle[i].style.colVisible){
									datastyle[i].style['typeindex'] = listindex
									listindex++
									var multiselect = util.gettagvalue(datastyle[i].style.tag, 'multiselect')
									if(multiselect == 1){
										that.repeatByColName = datastyle[i].name
										that.repeatByColTag = datastyle[i].style.tag
									}
								}
							}
						}
						
						var DataObjectExtData = uni.getStorageSync('DataObjectExtData')
						var customlist = []
						var temconditions = {}
						var conditions = div.style.conditions
						if(div.style.conditions != undefined){
							if(JSON.stringify(expArgs) != '[]' && JSON.stringify(conditions) != '[]' && JSON.stringify(conditions) != undefined){
								var temobj = {}
								for(var m=0; m<conditions.length; m++){
									for(var n=0; n<expArgs.length; n++){
										if(conditions[m].divArea == expArgs[n].divArea){
											var foreignKeyArr = conditions[m].foreignKeyArr
											for(var o=0; o<foreignKeyArr.length; o++){
												if(expArgs[n].colName == foreignKeyArr[o].baseKey){
													temobj[foreignKeyArr[o].foreignKey] = expArgs[n].value
												}
												if(foreignKeyArr[o].type === 'value'){
													temobj[foreignKeyArr[o].foreignKey] = foreignKeyArr[o].value 
												}
											}
										}
									}
								}
								temconditions[divArea] = temobj
							}
						}
						
						for(var k=0;k<datastyle.length;k++){
							if(datastyle[k].style.editStyle=='editmask' && datastyle[k].style.colType=='datetime'){
								datastyle[k].style['starts'] = '1990-01-01'
								datastyle[k].style['ends'] = '2100-01-01'
								datastyle[k].style['placeholder'] = '请选择'
								if(that.opttype == 'billadd'){
									var date = new Date()
									var time = util.formatTime2(date)
									datastyle[k].style['value'] = time
									datastyle[k].style['coldisplay'] =time
									datastyle[k].style['colValue'] = time
								}
							}
						}
						
						var divblock = {}
						var blockstyle = []
						if(JSON.stringify(divBlocks) != '[]' && divBlocks != undefined ){
							divBlocks.forEach((val, index) => {
								var block = []
								if(val.colNames != undefined){
									val.colNames.forEach((val2, index2) => {
										datastyle.forEach((val3, index3) => {
											if(val2 == val3.name){
												var item = datastyle[index3]
												datastyle.splice(index3, 1)
												block.push(item)
											}
										})
									})
								}
								divblock['blockName'] = val.blockName
								divblock['style'] = block
								divblock['property'] = val.property
								blockstyle.push(JSON.parse(JSON.stringify(divblock)) )
							})
						}
						if(JSON.stringify(datastyle) != '[]'){
							divblock['blockName'] = ''
							divblock['style'] = datastyle
							divblock['property'] = ''
							blockstyle.push(JSON.parse(JSON.stringify(divblock)))
						}
						
						var dataObject = div.style.dataObject
						var pageConditions = {}
						pageConditions['pageNumber'] = 1
						pageConditions['rowsPerPage'] = 20
						pageConditions['isAllData'] = false
						that.pageConditions = pageConditions
						
						var replaceConditions = {}
						var replaceColumns = div.style.replaceColumns
						if(JSON.stringify(replaceColumns) != '[]' && replaceColumns != undefined){
							for(var q=0; q<replaceColumns.length; q++){
								var type = replaceColumns[q].type
								if(type == 'column'){
									var colName= replaceColumns[q].column.colName
									replaceConditions[replaceColumns[q].toReplace] = conditions[colName]
								}
								if(type == 'value'){
									var replaceValue = replaceColumns[q].value
									if(replaceValue == "#PROJECTCODE#"){
										replaceConditions[replaceColumns[q].toReplace] = uni.getStorageSync('projectCode')
									}
								}
							}
						}
						
						console.log(blockstyle)
						that.halfDivArea = divArea
						that.halfconditions = temconditions
						var injson2 = '{"productCode":"' + productCode + '","terminalType":"' + terminaltype + '","projectCode":"' +
							projectCode + '","dbId":"' + dbId + '","templetName":"' + templetName + '","pageName":"' + pageName +
							'","menuId":"'+that.menuid+'","modId":"' + that.modid + '","sessionId":"' + sessionId + '","userId":"' + userId +
							'","userName":"' + userName + '","divArea":"' + divArea + '","dataObject":"' + dataObject + 
							'","conditions":' + JSON.stringify(temconditions) + 
							',"replaceConditions":' + JSON.stringify(replaceConditions) + 
							',"pageConditions":' + JSON.stringify(that.pageConditions) + '}';
						console.log('injson2' + injson2)
						var colNameWriteBackBasedOnvalue = ''
						var detailitem = that.datadetail[productindex]
						detailitem.forEach((val)=>{
							val.data.forEach((val2)=>{
								if(val2.name == that.colNameWriteBackBasedOn){
									colNameWriteBackBasedOnvalue = val2.style.colValue
								}
							})
						})
						var skuselected = that.skuselected
						skuselected.forEach((skus)=>{
							if(skus[that.colNameWriteBackBasedOn] == colNameWriteBackBasedOnvalue){
								var datalist = []
								var datalisttemp = []
								datalisttemp.push(skus)
								datalisttemp.forEach((val,index) => {
									var listtemp = []
									blockstyle.forEach((val2, index2) => {
										var style = val2.style
										var obj = {}
										obj['opttype'] = 'update'
										obj['divArea'] = divArea
										style.forEach((val3, index3,origin) => {
											if(val3.style.editStyle === 'dddw' && val3.style.dddw.name=='d_nvo_uipage_dwc'){
												var tag_dddwName = val3.style.tag_dddwName
												var tabval =  val[val3.name]
												var customlist = []
												for(var i=0; i<DataObjectExtData.length;i++){
													if(DataObjectExtData[i].dataobjectname == tag_dddwName && DataObjectExtData[i].coldata ==tabval){
														origin[index3].style['value'] = DataObjectExtData[i].coldata
														origin[index3].style['coldisplay'] = DataObjectExtData[i].coldisplay
														origin[index3].style['colValue'] = DataObjectExtData[i].coldisplay
													}
													if(DataObjectExtData[i].dataobjectname == tag_dddwName){
														customlist.push(DataObjectExtData[i])
														origin[index3].style['codeTable'] = customlist
													}
												}
											}else if(val3.name == 'urlfilename' || val3.name == 'urlfilenamex'){
												origin[index3].style['value'] = getApp().globalData.pic_address + val[val3.name]
												origin[index3].style['coldisplay'] = getApp().globalData.pic_address + val[val3.name]
												origin[index3].style['colValue'] = val[val3.name]
											}else{
												origin[index3].style['value'] = val[val3.name]
												origin[index3].style['coldisplay'] = val[val3.name]
												origin[index3].style['colValue'] = val[val3.name]
											}
											if((val3.style.initial != '' || val[val3.name]!='')){
												origin[index3].style.ismodified = true
											}
										})
										obj['property'] = val2.property
										obj['blockName'] = val2.blockName
										obj['id'] = index2
										obj['blockid'] = index
										obj['data'] = JSON.parse(JSON.stringify(style))
										listtemp.push(JSON.parse(JSON.stringify(obj)))
									})
									datalist.push(listtemp)
								})
								that.halfdatalist = datalist
								that.iscontentdetail1 = true
							}
						})
						
						if(that.iscontentdetail1)return
						
						uni.request({
							url: getApp().globalData.app_address + '?method=saas_PageDivData&parse=json',
							data: injson2,
							method: 'POST',
							header: {
								'content-type': 'application/x-www-form-urlencoded'
							},
							success: function(res2) {
								var result = res2.data;
								console.log(res2)
								var datalisttemp = result.data.div.value
								var datalist = []
								datalisttemp.forEach((val,index) => {
									var listtemp = []
									blockstyle.forEach((val2, index2) => {
										var style = val2.style
										var obj = {}
										obj['opttype'] = 'update'
										obj['divArea'] = divArea
										style.forEach((val3, index3,origin) => {
											if(val3.style.editStyle === 'dddw' && val3.style.dddw.name=='d_nvo_uipage_dwc'){
												var tag_dddwName = val3.style.tag_dddwName
												var tabval =  val[val3.name]
												var customlist = []
												for(var i=0; i<DataObjectExtData.length;i++){
													if(DataObjectExtData[i].dataobjectname == tag_dddwName && DataObjectExtData[i].coldata ==tabval){
														origin[index3].style['value'] = DataObjectExtData[i].coldata
														origin[index3].style['coldisplay'] = DataObjectExtData[i].coldisplay
														origin[index3].style['colValue'] = DataObjectExtData[i].coldisplay
													}
													if(DataObjectExtData[i].dataobjectname == tag_dddwName){
														customlist.push(DataObjectExtData[i])
														origin[index3].style['codeTable'] = customlist
													}
												}
											}else if(val3.name == 'urlfilename' || val3.name == 'urlfilenamex'){
												origin[index3].style['value'] = getApp().globalData.pic_address + val[val3.name]
												origin[index3].style['coldisplay'] = getApp().globalData.pic_address + val[val3.name]
												origin[index3].style['colValue'] = val[val3.name]
											}else{
												origin[index3].style['value'] = val[val3.name]
												origin[index3].style['coldisplay'] = val[val3.name]
												origin[index3].style['colValue'] = val[val3.name]
											}
										})
										obj['property'] = val2.property
										obj['blockName'] = val2.blockName
										obj['id'] = index2
										obj['blockid'] = index
										obj['data'] = JSON.parse(JSON.stringify(style))
										listtemp.push(JSON.parse(JSON.stringify(obj)))
									})
									datalist.push(listtemp)
								})
								that.halfdatalist = datalist
								that.iscontentdetail1 = true
								console.log(that.halfdatalist)
							},
						})
					},
				})
				
			})
			
			uni.$on("ensuresku", (datalist,parenttype,pagename,isdelete)=>{
				if(pagename!=this.pageName)return
				var skuitem = {}
				datalist.forEach((val)=>{
					val.data.forEach((val2)=>{
						skuitem[val2.name] = val2.style.colValue
					})
				})
				console.log(skuitem)
				var skuselected = that.skuselected
				var colNameWriteBackBasedOn = that.colNameWriteBackBasedOn
				var product = that.datadetail[that.detailindex]
				if(isdelete==''){
					product.forEach((val2,index2)=>{
						val2.data.forEach((val3,index3)=>{
							datalist.forEach((halfval)=>{
								halfval.data.forEach((halfval2)=>{
									if(halfval2.name == val3.name){
										product[index2].data[index3] = halfval2
									}
								})
							})
						})
					})
					that.datadetail[that.detailindex] = product
					skuselected.forEach((val,index)=>{
						if(val[colNameWriteBackBasedOn] == skuitem[colNameWriteBackBasedOn]){
							skuselected.splice(index, 1, skuitem)
						}
					})
					that.skuselected = skuselected
				}else{
					var datadetail =  that.datadetail
					var valtype = ''
					product.forEach((val)=>{
						valtype = val.opttype
						if(valtype!='insert'){
							val.opttype = 'delete'
						}
					})
					if(valtype=='insert'){
						datadetail.splice(that.detailindex, 1)
					}else{
						datadetail.splice(that.detailindex, 1, product)
					}
					that.datadetail = datadetail
					skuselected.forEach((val,index)=>{
						if(val[colNameWriteBackBasedOn] == skuitem[colNameWriteBackBasedOn]){
							skuselected.splice(index, 1)
						}
					})
					that.skuselected = skuselected
				}
				var colStyleSummary = that.colStyleSummary[0].data
				if(colStyleSummary != undefined){
					colStyleSummary.forEach((val)=>{
						var key = val.name.replace('sum_', '')
						var value = 0
						skuselected.forEach((val2)=>{
							 var tempval = (val2[key]==''|| val2[key]==undefined) ? 0 : parseInt(val2[key])
							 value += tempval
						})
						val.style.colValue = value
						val.style.value = value
						val.style.colVisible = value
					})
					that.colStyleSummary[0].data = colStyleSummary
				}
				this.iscontentdetail1 = false
			})
		
			uni.$on('cancelsku',()=>{
				this.iscontentdetail1 = false
			})
			
			
			// #ifdef APP-PLUS
			uni.$on('focuslist', async (listtype, listindex,listblockindex, listitemindex, itemobj,pagename)=>{
				
				if(pagename!= this.pageName)return
				if(listtype === 'dw_mx_head'){
					console.log('focuslist')
					this.inputVal = ''
					this.isfocus = false
					// clearInterval(this.interval2);
				}
			})
			// #endif
		},
		
		
		
		
		onShow:function(options){
			// #ifdef APP-PLUS
			// this.stop()
			this.bottomcount = 40 
			var that = this
			var main = plus.android.runtimeMainActivity(); //获取activity
			this.main = main
			var context = plus.android.importClass('android.content.Context'); //上下文    
			var receiver = plus.android.implements('io.dcloud.feature.internal.reflect.BroadcastReceiver', {  
				onReceive: doReceive  
			});  
			this.receiver = receiver
			var IntentFilter = plus.android.importClass('android.content.IntentFilter');  
			var Intent = plus.android.importClass('android.content.Intent');  
			var filter = new IntentFilter();  
			
			filter.addAction(uni.getStorageSync('pdaAction')); //监听扫描  
			
			main.registerReceiver(receiver, filter); //注册监听    
			
			function doReceive(context, intent) {  
				//通过intent实例引入intent类，方便以后的‘.’操作    
				plus.android.importClass(intent);  
				let barcode = intent.getStringExtra(uni.getStorageSync('pdaExtra')); // 广播标签
				console.log("进入了onReceive",barcode);
			  
				that.scanValue(barcode)  
			}  
			
			plus.key.addEventListener('keydown', that.keycodefun)
			
			// #endif
		},

		onHide:function(){
			console.log('onHide')
			// #ifdef APP-PLUS
			if(this.main!==''){
			
				this.main.unregisterReceiver(this.receiver);//取消监听 
				this.main =  ''
				this.receiver = ''
				plus.key.removeEventListener('keydown',this.keycodefun)
			}
			// #endif
		},
		
		onUnload:function(options){
			console.log('onUnload')
			uni.$off('updatelist')
			
			// #ifdef APP-PLUS
			if(this.main!==''){
				this.main.unregisterReceiver(this.receiver);//取消监听 
				this.main =  ''
				this.receiver = ''
				plus.key.removeEventListener('keydown',this.keycodefun)
				console.log('editdetail removeEventListener')
			}
			// #endif
			// clearTimeout(this.times)
			// clearInterval(this.interval)
			// clearInterval(this.interval2)
			try{
				console.log(this.whenClosed)
			if(this.whenClosed == 'refresh'){
				let pages = getCurrentPages();
				let beforePage = pages[pages.length  -2];
				beforePage.$vm.refresh()
			}}catch(e){}
			
		},
		
		//小程序不起效
		// onBackPress(options) {
		// 	console.log('backpress')
		//     if(this.whenClosed == 'refresh'){
		// 		let pages = getCurrentPages();
		// 		let beforePage = pages[pages.length  -2];
		// 		beforePage.$vm.refresh()
		//     }
		//     // 如果不是通过导航栏返回按钮触发，不阻止默认行为 
		//     return false;
		// },

		methods: {
			
			keycodefun(e){
				console.log('keydown',e) // 查看获取的信息，每个按键都会有不同的key值
				if (e.keyCode === 66) {
					// that.inputEnter(that.inputVal)
					// enter 66
					//back 4
					//delete 67
					// esc 111
				  
				}
			},
			
			async navitoscan(){
				var that = this
				uni.scanCode({
				     onlyFromCamera: true,
					 scanType: ['qrCode','barCode'],
				     success: function (res) {
				 		var inputvalue = res.result
						that.handleValue(inputvalue)
					},
				})
			},
			
			async inputblur(res){
				var that = this
				var scanValue = res.detail.value
				this.inputVal = 'aa'
				this.$nextTick(() => {
					this.inputVal = ''
				});
				
				that.handleValue(scanValue)
			},
			
			async inputEnter(res){
				var that = this
				this.inputVal = res
				this.$nextTick(() => {
					this.inputVal = ''
				});
				var scanValue = res 
				that.handleValue(scanValue)
			},
			
			async scanValue(res){
				var that = this
				this.inputVal = res
				this.$nextTick(() => {
					this.inputVal = ''
				});
				var scanValue = res 
				that.handleValue(scanValue)
			},
			
			async handleValue(scanValue){
				console.log('scanValue',scanValue)
				var that = this
				// let startDate = new Date()
				// startDate = startDate.toISOString().replace('T', ' ').slice(0, 19)
				if(scanValue === '')return
				var IsBarCode = that.page.IsBarCode==undefined?false:that.page.IsBarCode

				try{
					var listindex = 0
					if(!IsBarCode){
						var scanObj = JSON.parse(scanValue)
						if(scanObj['送货单号']!=undefined){
							scanObj['单据号'] = scanObj['送货单号']
							scanObj['单据类型'] = '采购送货单'
						}
						if(JSON.stringify(scanObj).indexOf('{')==-1) throw Error('扫描数据出错')
					}else{
						console.log('that.page.ScanPrefix',that.page.ScanPrefix)
						var ScanPrefix = that.page.ScanPrefix
						if(scanValue.indexOf(ScanPrefix)==-1){
							if(ScanPrefix!=''  && ScanPrefix!=undefined){
								scanValue = ScanPrefix + scanValue
							}
						}
						
					}
					var page = that.page
					var divlist = that.divlist
					var scanColArr = page.scanColArr
					var SaveSuccessMsgText = page.SaveSuccessMsgText
					var expArgs = that.expArgs
					console.log("scanColArr",scanColArr)
					
					var headdata = JSON.parse(JSON.stringify(that.dataList[listindex]))
					var divinitialValues = divlist.style.initialValues==undefined?[]:divlist.style.initialValues
					if(JSON.stringify(divinitialValues)!='[]'){
						headdata = that.$initialdatatrans(headdata, divinitialValues, expArgs)
					} 
					
					
					
					for(var k=0; k<scanColArr.length; k++){
						
						console.log('dddddddddd')
						
						var val = scanColArr[k]
						that.isNeedSave = val.isNeedSave
						if(val.resetType == 'onlyone' && prevalue!=''){
							throw Error('不能多次扫描')
							return
						}
						var noRowText = val.noRowText==undefined?'':val.noRowText
						var checkBeforeDo = val.checkBeforeDo
						
						
						 
						if(!IsBarCode){
						
							console.log('scanObj[val.scanShowKey]',scanObj[val.scanShowKey])
							console.log(scanObj[val.scanShowKey] == undefined)
							if(scanObj[val.scanShowKey] === undefined) continue
							var parseQR = val.parseQR
							var hvaluepre = ''
							var clearData =  val.clearData==undefined?false:val.clearData
							if(clearData){
								headdata.forEach((hval)=>{
									hval.data.forEach((hval2)=>{
										hval2.style.colValue = ''
										hval2.style.value =''
										hval2.style.coldisplay =''
									})
								})
							}
							
							
							parseQR.forEach((pval)=>{
								headdata.forEach((hval)=>{
									hval.data.forEach((hval2)=>{
										if(pval.colName == hval2.name){
											hvaluepre =scanObj[pval.scanKey]
											if(hvaluepre!==undefined){
												hval2.style.colValue =hvaluepre
												hval2.style.value =hvaluepre
												hval2.style.coldisplay =hvaluepre
											}
										}
									})
								})
							})
							// if(hvaluepre==='' ){
								// throw Error('条码不正确!')
								// return
							// }
							var checkArgsIsEqual = val.checkArgsIsEqual
							
							checkArgsIsEqual.forEach((val2)=>{
								expArgs.forEach((val3)=>{
									if(val3.colName == val2.argKey){
										if(scanObj[val2.scanKey] != val3.value && scanObj[val2.scanKey]!=''){
											throw Error(val.msgText)
											return
										}
									}
								})
								
							})
							
							
							
							var scanUnique = val.scanUnique
							that.scanUAssi(scanUnique,headdata,true)
							
							var needOtherColumn = val.needOtherColumn==undefined?[]:val.needOtherColumn
							if(JSON.stringify(needOtherColumn)!='[]'){
								needOtherColumn.forEach((neVal)=>{
									headdata.forEach((hval)=>{
										hval.data.forEach((hval2)=>{
											if(neVal.colName == hval2.name){
												if(hval2.style.colValue==='' || hval2.style.colValue===undefined){
													throw Error(neVal.msgText)
													return
												}
											}
										})
									})
								})
							}
							
							
							
							that.dataList[listindex] = headdata
							
							var showValue = scanObj[val.scanShowKey]
							
							
							if(val.resetType == "reset" && showValue!=''){
								that.datadetail = that.olddatadetail
								that.scanUArr = []
								return
							}
							
							if(val.resetType=="replace" && showValue!=''){
								var ddre = JSON.parse(JSON.stringify(that.datadetail))
								ddre.forEach((vdd)=>{
									vdd.forEach((vdd3)=>{
										vdd3.data.forEach((vdd2)=>{
											if(vdd2.name == val.colName){
												vdd2.style.colValue =showValue
												vdd2.style.value =showValue
												vdd2.style.coldisplay =showValue
											}
										})
									})
									
								})
								that.datadetail = ddre
								if(!(val.isNeedGetData)){
									// #ifdef APP-PLUS
									that.playaudio('/static/success.mp3')
									// #endif
								}
								that.$forceUpdate()
							}
						}else{
							
							console.log(JSON.parse(JSON.stringify(headdata)))
							
							headdata.forEach((hval)=>{
								hval.data.forEach((hval2)=>{
									if(val.colName == hval2.name){
										hval2.style.colValue = scanValue
										hval2.style.value = scanValue
										hval2.style.coldisplay = scanValue
									}
								})
							})
							var scanUnique = val.scanUnique
						}
						
						//这是为了单条数据扫描使用
						if(val.resetType == "reset"){
							that.datadetail = that.olddatadetail
						}
						
						
						var tempconditons = {}
						var conObj = {}
						var conditons = divlist.style.conditions===undefined?[]:divlist.style.conditions
						console.log(conditons)
						if(conditons!==undefined){
							conditons.forEach((val)=>{
								if(val.pageFrom =='parent'){
									var foreignKeyArr = val.foreignKeyArr
									foreignKeyArr.forEach((val2)=>{
										expArgs.forEach((val3)=>{
											if(val2.baseKey == val3.colName){
												conObj[val2.foreignKey] = val3.value
											}
										})
									})
								}else if(val.pageFrom == 'this'){
									var foreignKeyArr = val.foreignKeyArr
									foreignKeyArr.forEach((val2)=>{
										headdata.forEach((hval)=>{
											hval.data.forEach((hval2)=>{
												if(val2.baseKey == hval2.name && hval2.style.colValue!=''){
													conObj[val2.foreignKey] = hval2.style.colValue
												}
											})
										})
									})
								}
							})
						}
						tempconditons[divlist.divArea] = conObj
						var replaceConditions = {}
						var divreplaceColumns = divlist.style.replaceColumns==undefined?[]:divlist.style.replaceColumns
						replaceConditions = that.$replaceConditionstrans(replaceConditions, divreplaceColumns,'',headdata)
						replaceConditions = that.$replaceConditionstrans(replaceConditions, divreplaceColumns,'',expArgs)
						var pageConditions = that.pageConditions
						pageConditions.isAllData = true
						
						if(val.isNeedGetData){
							var injson2 = common.requestDataPre(that.jsonoptions, divlist.divArea, divlist.style.dataObject, replaceConditions, tempconditons, pageConditions)
							console.log(injson2)
							console.log('that.isGetHeadDataAfterCommit',that.isGetHeadDataAfterCommit)
							if(that.isGetHeadDataAfterCommit)  that.headconditions = injson2
							console.log('that.headconditions',that.headconditions)
							var url = getApp().globalData.app_address + '?method=saas_PageDivData&parse=json'
							const { data: res } = await infolistutil.post2(url, injson2);
							console.log('返回结果',JSON.parse(JSON.stringify(res)))
							var datalisttemp = res.data.div.value
							
							if(JSON.stringify(datalisttemp) != '[]'){
								
								that.scanheadResAssi(scanColArr,headdata,datalisttemp,divlist)
								
								if(JSON.stringify(checkBeforeDo)!='{}' && checkBeforeDo!=undefined){
									var MsgText = checkBeforeDo.MsgText
									var checkArr = checkBeforeDo.checkArr
									var userConfirmed = true
									var checkColName= checkBeforeDo.colName
									headdata.forEach((hval)=>{
										hval.data.forEach((hval2)=>{
											if(checkColName == hval2.name){
												checkBeforeDo.colValue = hval2.style.colValue
											}
										})
									})
									if(MsgText != ''){
										if(MsgText.indexOf('#'+checkColName+'#')!=-1){
											MsgText = MsgText.replace('#'+checkColName+'#', checkBeforeDo.colValue)
										}
										userConfirmed = await that.showModalAndWait(MsgText);
									}
									
									if (userConfirmed) {
										if(JSON.stringify(checkArr)!='[]'){
											var injsoncheck = common.requestCheckData(that.jsonoptions, divlist.divArea, divlist.style.dataObject, datalisttemp, checkBeforeDo)
											var url = getApp().globalData.app_address + '?method=saas_PageCheckBeforeEvent&parse=json'
											const { data: rescheck } = await infolistutil.post2(url, injsoncheck);
											if(rescheck.rtn == 1){
												if(!rescheck.data.allowToPass){
													if(!IsBarCode){
														that.scanUAssi(scanUnique,headdata,false)
													}
													throw Error(rescheck.data.msgText)
													return
												}
											}
											
										}
									} else {
										if(!IsBarCode){
											that.scanUAssi(scanUnique,headdata,false)
										}
										throw Error('')
										return
									}
								}
								
								console.log('val.retrieveDetail',val.retrieveDetail)
								
								if(val.retrieveDetail!=undefined && val.retrieveDetail){
									tempconditons = {}
									var conObj = {}
									var conditons = that.divdetail.style.conditions
									conditons.forEach((val)=>{
										if(val.pageFrom =='parent'){
											var foreignKeyArr = val.foreignKeyArr
											foreignKeyArr.forEach((val2)=>{
												expArgs.forEach((val3)=>{
													if(val2.baseKey == val3.colName){
														conObj[val2.foreignKey] = val3.value
													}
												})
											})
										}else if(val.pageFrom == 'this'){
											var foreignKeyArr = val.foreignKeyArr
											foreignKeyArr.forEach((val2)=>{
												headdata.forEach((hval)=>{
													hval.data.forEach((hval2)=>{
														if(val2.baseKey == hval2.name && hval2.style.colValue!=''){
															conObj[val2.foreignKey] = hval2.style.colValue
														}
													})
												})
											})
										}
									})
									tempconditons[that.divdetail.divArea] = conObj
									var injsondetail = common.requestDataPre(that.jsonoptions, that.divdetail.divArea, that.divdetail.style.dataObject, replaceConditions, tempconditons, pageConditions)
									console.log('injsondetail',injsondetail)
									var url = getApp().globalData.app_address + '?method=saas_PageDivData&parse=json'
									const { data: res } = await infolistutil.post2(url, injsondetail);
									console.log('返回结果',JSON.parse(JSON.stringify(res)))
									datalisttemp = res.data.div.value
									that.scanResMultiAssi( datalisttemp, that.divdetail)
								}else{
									that.scanResAssi(scanColArr,headdata,datalisttemp,divlist)
								}
								console.log('that.datadetail',that.datadetail)
								if(val.isNeedSave){
									var btnname = ''
									var btntext = ''
									var btntodo = ''
									let btn = {}
									try{
										btn = that.hidebtn[0]
									}catch(e){
										btn['name'] = 'save'
										btn['text'] = '保存'
										btn['btnToDo'] = 'saveandadd'
									}
									// let startDate2 = new Date()
									// startDate2 = startDate2.toISOString().replace('T', ' ').slice(0, 19)
									const {data:saveVal} = await that.saveRes(btn,0);
									console.log('saveVal',JSON.parse(JSON.stringify(saveVal)))
									// let startDate3 = new Date()
									// startDate3 = startDate3.toISOString().replace('T', ' ').slice(0, 19)
									// logger.info('开始时间'+startDate + '   提交前的时间'+startDate2 + '    提交完成的时间'+startDate3)
									if(saveVal.rtn==undefined || saveVal.rtn == -1){
										that.bottommsg = saveVal.message==undefined?saveVal:saveVal.message
										// #ifdef APP-PLUS
										that.playaudio('/static/error.mp3')
										// #endif
									}else{
										
										let btnToDo = btn.btnToDo
										
										
										console.log('headconditionsbtnToDo',btnToDo)
										
										if(JSON.stringify(that.headconditions) != '{}'){
											if(btnToDo == 'saveandadd'){ //这是为了清数据
												that.datadetail = JSON.parse(JSON.stringify(that.olddatadetail))
											}
											var p  = new  Promise(function(resolve, reject){
												var url = getApp().globalData.app_address + '?method=saas_PageDivData&parse=json'
												infolistutil.post2(url, that.headconditions).then(function(res){
													var result = res.data;
													return resolve(result.data.div.value)
												});
												
											});
											p.then(function(data){
												console.log('that.headconditions', JSON.parse(JSON.stringify(data)))
												
												if(JSON.stringify(data) != '[]'){
													that.scanheadResAssi(scanColArr,that.dataList[listindex],data,divlist)
													// that.scanResAssi(scanColArr,headdata,data,divlist) //这句话不知道为什么加上了
													that.$forceUpdate()
												}
												that.bottommsg = SaveSuccessMsgText
												// #ifdef APP-PLUS
												that.playaudio('/static/success.mp3')
												// #endif
											})
											
										}else{
											if(btnToDo == 'saveandadd'){ //这是为了清数据
												that.clearData(scanColArr)
											}
											// #ifdef APP-PLUS
											that.playaudio('/static/success.mp3')
											// #endif
											that.bottommsg = SaveSuccessMsgText
										}
									}
								}else{
									console.log('success.mp3')
									// #ifdef APP-PLUS
									that.playaudio('/static/success.mp3')
									// #endif
									that.bottommsg = that.page.RetrieveSuccessMsgText
								}
							}else{
								that.clearData(scanColArr)
								that.bottommsg = noRowText
								// #ifdef APP-PLUS
								that.playaudio('/static/error.mp3')
								// #endif
							}
						}else{
							that.bottommsg = that.page.FirstMsgText
						}
						
						if(val.retrieveDetail!=undefined && val.retrieveDetail){
							tempconditons = {}
							var conObj = {}
							var conditons = that.divdetail.style.conditions
							conditons.forEach((val)=>{
								if(val.pageFrom =='parent'){
									var foreignKeyArr = val.foreignKeyArr
									foreignKeyArr.forEach((val2)=>{
										expArgs.forEach((val3)=>{
											if(val2.baseKey == val3.colName){
												conObj[val2.foreignKey] = val3.value
											}
										})
									})
								}else if(val.pageFrom == 'this'){
									var foreignKeyArr = val.foreignKeyArr
									foreignKeyArr.forEach((val2)=>{
										headdata.forEach((hval)=>{
											hval.data.forEach((hval2)=>{
												if(val2.baseKey == hval2.name && hval2.style.colValue!=''){
													conObj[val2.foreignKey] = hval2.style.colValue
												}
											})
										})
									})
								}
							})
							tempconditons[that.divdetail.divArea] = conObj
														
							var injsondetail = common.requestDataPre(that.jsonoptions, that.divdetail.divArea, that.divdetail.style.dataObject, replaceConditions, tempconditons, pageConditions)
							console.log('injsondetail',injsondetail)
							var url = getApp().globalData.app_address + '?method=saas_PageDivData&parse=json'
							const { data: res } = await infolistutil.post2(url, injsondetail);
							console.log('返回结果',JSON.parse(JSON.stringify(res)))
							datalisttemp = res.data.div.value
							that.scanResMultiAssi( datalisttemp, that.divdetail)
						}
					
					}
					
				}catch(e){
					if(e.message!=''){
						if(e.message.indexOf('Unexpected') != '-1'){
							var page = that.page
							var scanColArr = page.scanColArr
							that.clearData(scanColArr)
							that.bottommsg = '扫码失败，请重新扫描！'
						}else{
							that.bottommsg = e.message
						}
						// #ifdef APP-PLUS
						that.playaudio('/static/error.mp3')
						// #endif
					}
					
				}
				
			},
			
			playaudio(url){
				// const soundUrl = url;
				// let _audio = null
				// function playSound(url) {
				// 	if (_audio) {
				// 		console.log('playsound')
				// 		_audio = null
				// 	}
				// 	_audio = plus.audio.createPlayer(url);
				// 	_audio.play();
				// 	_audio = null
				// }
				// function onScan() {
				// 	playSound(soundUrl);
				// }
				// onScan();
				
				
				const innerAudioContext = uni.createInnerAudioContext();
				innerAudioContext.autoplay = true;
				innerAudioContext.src = url;
				innerAudioContext.onPlay(() => {
				  console.log('开始播放');
				});
				innerAudioContext.onError((res) => {
				  console.log(res.errMsg);
				  console.log(res.errCode);
				});
				innerAudioContext.onPause(function() {
					innerAudioContext.destroy();//音频播放停止后，就销毁实例
				});
			},
			
			stop(){
				var that = this
			    var interval = setInterval(function(){
				    uni.hideKeyboard();
			    },20);
				
				var interval2 = setInterval(function(){
					that.isfocus = false
					that.$nextTick(() => {
						that.inputVal = ''
						that.isfocus = true
					});
				},1500)
				
				var times = setTimeout(() => {
				    clearInterval(interval);
					clearInterval(interval2);
				},3000000);
				this.interval = interval
				this.interval2 = interval2
				this.times = times
				this.isfocus = false
				this.$nextTick(() => {
					this.isfocus = true
				});
			},
			
			clearData(scanColArr){
				var that = this
				var listindex = 0
				let preheaddata = JSON.parse(JSON.stringify(that.dataList[listindex]))
				let preoldheaddata = JSON.parse(JSON.stringify(that.olddatalist[listindex]))
				scanColArr.forEach((sssVal)=>{
					if(!sssVal.isNeedGetData){
						preoldheaddata.forEach((hval,hindex)=>{
							if(hval.blockName=='') hval.data = preheaddata[hindex].data
							hval.data.forEach((hval2,hindex2)=>{
								if(sssVal.colName == hval2.name){
									let sssvalue = preheaddata[hindex].data[hindex2].style.colValue
									hval2.style.colValue = sssvalue
									hval2.style.value = sssvalue
									hval2.style.coldisplay = sssvalue
								}
							})
						})
					}
				})
				that.dataList[listindex]  = preoldheaddata
				that.datadetail = JSON.parse(JSON.stringify(that.olddatadetail))
			},
			
			async showModalAndWait(MsgText) {
			  return new Promise((resolve, reject) => {
			    uni.showModal({
			      title: '提示',
			      content: MsgText,
			      success: (res) => {
			        if (res.confirm) {
			          resolve(true);
			        } else if (res.cancel) {
			          resolve(false);
			        }
			      },
			      fail: (error) => {
			        reject(error);
			      }
			    });
			  });
			},
			
			async getdatalist(url, injson2,blockstyle,divarea,valtype,that){
				try{
			
				const { data: res } = await infolistutil.post2(url, injson2);
				console.log(divarea)
				console.log(res)
				if(res.rtn == -1) return
				if(divarea == 'dw_mx_bottom'){
					var sharedataDw = that.divbottom.style.sharedataDw
					if(sharedataDw != undefined){
						var datalisttemp = that.olddatalisttemp
					}else{
						var datalisttemp = res.data.div.value
					}
				}else{
					var datalisttemp = res.data.div.value
				}
				var datalist = []
				datalist = that.$datalisttrans(datalist, datalisttemp, blockstyle,valtype, divarea)
				if(divarea == 'dw_mx_head'){
					that.dataList = datalist
					that.olddatalist = JSON.parse(JSON.stringify(datalist))
					console.log('that.dataList',JSON.parse(JSON.stringify(that.dataList)))
					that.olddatalisttemp = JSON.parse(JSON.stringify(datalisttemp))
				}else if(divarea == 'dw_mx_detail'){
					that.datadetail = datalist
					that.skuselected = datalisttemp
					that.detailblockstyle =  blockstyle
					that.detaildivarea= divarea
					var colStyleSummary = JSON.parse(JSON.stringify(that.precolStyleSummary)) 
					try{
					if(JSON.stringify(colStyleSummary)!= '[]'){
						colStyleSummary.forEach((val)=>{
							var key = val.name.replace('sum_', '')
							var value = 0
							datalisttemp.forEach((val2)=>{
								 var tempval = (val2[key]==''|| val2[key]==undefined) ? 0 : parseInt(val2[key])
								 value += tempval
							})
							val.style.colValue = value
							val.style.value = value
							val.style.colVisible = value
							
							blockstyle.forEach((val2, index2) => {
								var style = val2.style
								style.forEach((val3, index3) => {
									if(val3.name == key){
										val.style.colText = val3.style.colText
									}
								})
							})
						})
					}
					var arr = []
					var obj = {}
					obj['data'] = colStyleSummary
					obj['property'] = {'title':'汇总'}
					arr.push(obj)
					that.colStyleSummary = arr
					console.log('that.colStyleSummary',JSON.parse(JSON.stringify(that.colStyleSummary)))
					}catch(e){
						console.log(e)
					}
					that.oldskuselected = JSON.parse(JSON.stringify(datalisttemp))
					that.olddatadetail = JSON.parse(JSON.stringify(datalist))
					console.log('that.datadetail',JSON.parse(JSON.stringify(that.datadetail)))
				}else if(divarea == 'dw_mx_pic'){
					that.datapic = datalist
					that.olddatapic = JSON.parse(JSON.stringify(datalist))
					that.$forceUpdate()
					
				}else if(divarea == 'dw_mx_bottom'){
					that.databottom = datalist
					that.olddatabottom = JSON.parse(JSON.stringify(datalist))
				}else if(divarea == 'dw_mx_audit'){
					var divaudit = that.divaudit
					console.log(divaudit)
					var setDefaultValuesRuleWhenEdit = divaudit.style.setDefaultValuesRuleWhenEdit
					var values = divaudit.style.setDefaultValuesWhenEdit
					if(setDefaultValuesRuleWhenEdit != undefined){
						datalist = processInitialData.defaultvaluesedit(values,datalist,setDefaultValuesRuleWhenEdit)
					}
					that.dataaudit = datalist
					that.olddataaudit = JSON.parse(JSON.stringify(datalist))
					
				}
				
				}catch(e){
				}
			},
			
			async getheaddatalist(url, injson2, that){
				const { data: res } = await infolistutil.post2(url, injson2);
				var result = res.data;
				that.rtndatalist = result.div.value[0]
			},
			
			scanheadResAssi(scanColArr,headdata,datalisttemp,divlist){
				var that = this
				scanColArr.forEach((sval)=>{
					headdata.forEach((hval)=>{
						hval.data.forEach((hval2)=>{
							if(sval.colName == hval2.name){
								datalisttemp[0][sval.colName] = hval2.style.colValue
							}
						})
					})
				})

				var datalist = []
				var DataObjectExtData = uni.getStorageSync('DataObjectExtData')
				var blockstyle = that.listblcokstyle
				datalisttemp.forEach((val,index) => {
					var listtemp = []
					blockstyle.forEach((val2, index2) => {
						var style = val2.style
						var obj = {}
						obj['opttype'] = 'insert'
						obj['divArea'] = divlist.divArea
						style.forEach((val3, index3,origin) => {
							if(val3.style.editStyle === 'dddw' && val3.style.dddw.name=='d_nvo_uipage_dwc'){
								var tag_dddwName = val3.style.tag_dddwName
								var tabval =  val[val3.name]
								var customlist = []
								for(var i=0; i<DataObjectExtData.length;i++){
									if(DataObjectExtData[i].dataobjectname == tag_dddwName && DataObjectExtData[i].coldata ==tabval){
										origin[index3].style['value'] = DataObjectExtData[i].coldata
										origin[index3].style['coldisplay'] = DataObjectExtData[i].coldisplay
										origin[index3].style['colValue'] = DataObjectExtData[i].coldisplay
									}
									if(DataObjectExtData[i].dataobjectname == tag_dddwName){
										customlist.push(DataObjectExtData[i])
										origin[index3].style['codeTable'] = customlist
									}
								}
							}else if(val3.name == 'urlfilename' || val3.name == 'urlfilenamex'){
								origin[index3].style['value'] = getApp().globalData.pic_address + val[val3.name]
								origin[index3].style['coldisplay'] = getApp().globalData.pic_address + val[val3.name]
								origin[index3].style['colValue'] = val[val3.name]
							}else if(val3.style.colType == "datetime" && val3.style.forma != ''){
								var date = new Date(val[val3.name])
								var datestr = util.formatdatecustom(date, val3.style.format)
								origin[index3].style['value'] = datestr
								origin[index3].style['coldisplay'] = datestr
								origin[index3].style['colValue'] = datestr
							}else{
								origin[index3].style['value'] = val[val3.name]
								origin[index3].style['coldisplay'] = val[val3.name]
								origin[index3].style['colValue'] = val[val3.name]
							}
						})
						obj['property'] = val2.property
						obj['blockName'] = val2.blockName
						obj['id'] = index2
						obj['blockid'] = index
						obj['data'] = JSON.parse(JSON.stringify(style))
						listtemp.push(JSON.parse(JSON.stringify(obj)))
					})
					datalist.push(listtemp)
				})
				
				that.dataList = datalist
				
				console.log(JSON.parse(JSON.stringify(datalist)))
				that.$forceUpdate()
			},
			
			scanResAssi(scanColArr,headdata,datalisttemp,divlist){
				var that = this
				scanColArr.forEach((sval)=>{
					headdata.forEach((hval)=>{
						hval.data.forEach((hval2)=>{
							if(sval.colName == hval2.name){
								datalisttemp[0][sval.colName] = hval2.style.colValue
							}
						})
					})
				})
				var datalist = []
				var DataObjectExtData = uni.getStorageSync('DataObjectExtData')
				var blockstyle = that.listblcokstyle
				
				
				datalisttemp.forEach((val,index) => {
					var listtemp = []
					blockstyle.forEach((val2, index2) => {
						var style = val2.style
						var obj = {}
						obj['opttype'] = 'insert'
						obj['divArea'] = divlist.divArea
						style.forEach((val3, index3,origin) => {
							if(val3.style.editStyle === 'dddw' && val3.style.dddw.name=='d_nvo_uipage_dwc'){
								var tag_dddwName = val3.style.tag_dddwName
								var tabval =  val[val3.name]
								var customlist = []
								for(var i=0; i<DataObjectExtData.length;i++){
									if(DataObjectExtData[i].dataobjectname == tag_dddwName && DataObjectExtData[i].coldata ==tabval){
										origin[index3].style['value'] = DataObjectExtData[i].coldata
										origin[index3].style['coldisplay'] = DataObjectExtData[i].coldisplay
										origin[index3].style['colValue'] = DataObjectExtData[i].coldisplay
									}
									if(DataObjectExtData[i].dataobjectname == tag_dddwName){
										customlist.push(DataObjectExtData[i])
										origin[index3].style['codeTable'] = customlist
									}
								}
							}else if(val3.name == 'urlfilename' || val3.name == 'urlfilenamex'){
								origin[index3].style['value'] = getApp().globalData.pic_address + val[val3.name]
								origin[index3].style['coldisplay'] = getApp().globalData.pic_address + val[val3.name]
								origin[index3].style['colValue'] = val[val3.name]
							}else if(val3.style.colType == "datetime" && val3.style.forma != ''){
								var date = new Date(val[val3.name])
								var datestr = util.formatdatecustom(date, val3.style.format)
								origin[index3].style['value'] = datestr
								origin[index3].style['coldisplay'] = datestr
								origin[index3].style['colValue'] = datestr
							}else{
								origin[index3].style['value'] = val[val3.name]
								origin[index3].style['coldisplay'] = val[val3.name]
								origin[index3].style['colValue'] = val[val3.name]
							}
						})
						obj['property'] = val2.property
						obj['blockName'] = val2.blockName
						obj['id'] = index2
						obj['blockid'] = index
						obj['data'] = JSON.parse(JSON.stringify(style))
						listtemp.push(JSON.parse(JSON.stringify(obj)))
					})
					datalist.push(listtemp)
				})
				
				var datadetail = JSON.parse(JSON.stringify(that.datadetail)) 
				datadetail[0].forEach((val)=>{
					val['isnewitem'] = true
					val['opttype'] = 'insert'
					val.data.forEach((val2)=>{
						Object.keys(datalisttemp[0]).forEach(key => {
							if(val2.name == key){
								var dvalue = datalisttemp[0][key]
								val2.style.value = dvalue
								val2.style.colValue = dvalue
								val2.style.coldisplay = dvalue
								val2.style.ismodified = true
							}
						})
					});
				})
				
				if(that.templetName != 'appsj_scan_single'){
					// if(that.templetName != 'appsj_scan_single' || !that.isNeedSave){
					if(that.datadetail[0][0].isnewitem == undefined){
						datadetail.splice(0, 1, datadetail[0])
						that.datadetail = datadetail
					}else{
						that.datadetail.push(datadetail[0])
					}
				}else{
					that.datadetail =  datadetail
				}
				
				console.log('datadetail',that.datadetail)
				that.$forceUpdate()
			},
			
			scanResMultiAssi(datalisttemp,divdetail){
				var that = this
				var datalist = []
				var DataObjectExtData = uni.getStorageSync('DataObjectExtData')
				var blockstyle = that.detailblockstyle
				datalisttemp.forEach((val,index) => {
					var listtemp = []
					blockstyle.forEach((val2, index2) => {
						var style = val2.style
						var obj = {}
						obj['opttype'] = 'insert'
						obj['blockid'] = index2
						obj['divArea'] = divdetail.divArea
						style.forEach((val3, index3,origin) => {
							if(val3.style.editStyle === 'dddw' && val3.style.dddw.name=='d_nvo_uipage_dwc'){
								var tag_dddwName = val3.style.tag_dddwName
								var tabval =  val[val3.name]
								var customlist = []
								for(var i=0; i<DataObjectExtData.length;i++){
									if(DataObjectExtData[i].dataobjectname == tag_dddwName && DataObjectExtData[i].coldata ==tabval){
										origin[index3].style['value'] = DataObjectExtData[i].coldata
										origin[index3].style['coldisplay'] = DataObjectExtData[i].coldisplay
										origin[index3].style['colValue'] = DataObjectExtData[i].coldisplay
									}
									if(DataObjectExtData[i].dataobjectname == tag_dddwName){
										customlist.push(DataObjectExtData[i])
										origin[index3].style['codeTable'] = customlist
									}
								}
							}else if(val3.name == 'urlfilename' || val3.name == 'urlfilenamex'){
								origin[index3].style['value'] = getApp().globalData.pic_address + val[val3.name]
								origin[index3].style['coldisplay'] = getApp().globalData.pic_address + val[val3.name]
								origin[index3].style['colValue'] = val[val3.name]
							}else if(val3.style.colType == "datetime" && val3.style.forma != ''){
								var date = new Date(val[val3.name])
								var datestr = util.formatdatecustom(date, val3.style.format)
								origin[index3].style['value'] = datestr
								origin[index3].style['coldisplay'] = datestr
								origin[index3].style['colValue'] = datestr
							}else{
								origin[index3].style['value'] = val[val3.name]
								origin[index3].style['coldisplay'] = val[val3.name]
								origin[index3].style['colValue'] = val[val3.name]
							}
						})
						obj['property'] = val2.property
						obj['blockName'] = val2.blockName
						obj['id'] = index2
						obj['isnewitem'] = true
						obj['blockid'] = index
						obj['data'] = JSON.parse(JSON.stringify(style))
						listtemp.push(JSON.parse(JSON.stringify(obj)))
					})
					datalist.push(listtemp)
				})
				that.datadetail = datalist
				console.log('datadetail',JSON.parse(JSON.stringify(that.datadetail)))
			},
			
			scanUAssi(scanUnique,headdata,ispush){
				var that = this
				if(JSON.stringify(scanUnique)!='[]'){
					var scanUStr = ''
					scanUnique.forEach((uval)=>{
						headdata.forEach((hval)=>{
							hval.data.forEach((hval2)=>{
								if(uval == hval2.name){
									scanUStr += hval2.style.colValue+''
								}
							})
						})
					})
					var scanUArr = that.scanUArr
					if(JSON.stringify(scanUArr)!='[]'){
						if(ispush){
							scanUArr.forEach((Aval)=>{
								if(Aval == scanUStr){
									throw Error('此条码已扫描')
									return
								}
							})
						}else{
							scanUArr = scanUArr.filter(item => item !== scanUStr)
						}
					}
					if(ispush){
						scanUArr.push(scanUStr)
					}
					that.scanUArr = scanUArr
				}
			},
			
			detailitemclick(index){
				var that = this
				var rowClick = that.divdetail.style.rowClick
				if(JSON.stringify(rowClick)!='{}'){
					var datalist = that.datadetail[index]
					var title = rowClick.title
					var expArgs = rowClick.expArgs
					var opttype = rowClick.toDo
					var templetname = rowClick.templetName
					var pagename = rowClick.pageName 
					var menuid = that.menuid
					var modid = that.modid
					var conditions = {}
					conditions = that.$getlistCon(expArgs,that.divdetail.style,datalist,conditions)
					expArgs = that.$getlistArg(expArgs,that.divdetail.style,datalist,{})
					var whenClosed = ''
					whenClosed = rowClick.whenClosed==undefined?'':rowClick.whenClosed
					if(templetname == 'appsj_detail'){
						uni.navigateTo({url:'/pages/editorderdetail/editorderdetail?templatename='+templetname+'&pagename='+pagename+'&title='+title+'&menuid='+menuid+'&modid='+modid+'&divArea='+that.divdetail.divArea+'&opttype='+opttype+'&whenClosed='+whenClosed+'&expArgs='+JSON.stringify(expArgs)})
					}else if(templetname == 'appsj_list'){
						uni.navigateTo({url:'/pages/infolist/infolist?templatename='+templetname+'&pagename='+pagename+'&menuid=&modid='+modid+'&divArea=&opttype=&menuname='+title+'&whenClosed='+whenClosed+'&conditions='+JSON.stringify(conditions)})
					}
				}
			},
			
			updatedddwlistvalue(item,listindex,index,itemchanged,divArea){
				var that = this
				if(index!=''){
					if(divArea == 'dw_mx_detail'){
						that.$refs.styledetail2[listindex].updatedddwlistvalue(item,index,itemchanged)
					}else{
						that.$refs.stylehead[listindex].updatedddwlistvalue(item,index,itemchanged)
					}
				}
			},
			
			updatelistvalue(content){
				var that = this
				var index1 = that.indexitem
				if(content.typeindex!=''){
					if(content.styletype=='style_detailview2'){
						that.$refs.styledetailview2[content.typeindex].updatelistvalue(content)
					}else if(content.styletype=="style_head"){
						that.$refs.stylehead[content.typeindex].updatelistvalue(content)
					}
				}
			},
			
			async btnclick(index){
				var that = this
				var btns = that.btns
				console.log(btns)
				console.log(btns[index])
				var btntype = btns[index].name
				var btntext = btns[index].text
				var todo = btns[index].btnToDo
				var productCode = uni.getStorageSync('productCode')
				var sessionId = uni.getStorageSync('sessionId')
				var projectCode = uni.getStorageSync('projectCode')
				var terminaltype = uni.getStorageSync('terminaltype')
				var dbId = uni.getStorageSync('dbId')
				var userId = uni.getStorageSync('userId')
				var userName = uni.getStorageSync('userName')
				console.log(userName)
				
				
				
				var injsondate =that.$requestDate()
				var urldate = getApp().globalData.app_address + '?method=getDate&parse=json'
				const { data: dateres } = await that.$post2(urldate, injsondate);
						console.log(dateres)
						var datestr = dateres.data.getDate
						console.log(datestr)
						var date = datestr.substring(0,19)
						console.log(todo)
						
						if(todo.indexOf('save')!=-1){
							//#ifdef APP-PLUS
							var interval2 = setInterval(function(){
								that.isfocus = false
								that.$nextTick(() => {
									that.inputVal = ''
									that.isfocus = true
								});
							},1500)
							that.interval2 = interval2
							//#endif
							
							var clicked = btns[index].clicked
							if(JSON.stringify(clicked)!='{}'){
								var checkBeforeDo = clicked.checkBeforeDo
								if(JSON.stringify(checkBeforeDo)!='{}' && checkBeforeDo!=undefined){
									var checkArr = checkBeforeDo.checkArr
									if(JSON.stringify(checkArr)!='[]'){
										
									}else{
										var msgText = checkBeforeDo.msgText
										uni.showModal({
											title: '提示',
											content: msgText,
											success: function (res) {
												if (res.confirm) {
													that.savecommit(index)
												} 
											}
										})
									}
								}else{
									that.savecommit(index)
								}
							}else{
								that.savecommit(index)
							}
						}else if(todo=='openpage'){
							var clicked = btns[index].clicked
							console.log(clicked)
							var title = clicked.title
							var pagename = clicked.pagename
							var window = clicked.templetname
							var modcode = that.modcode
							var compute_rowcode = that.compute_rowcode
							if(window=='appsj_detail'){
								uni.navigateTo({url:'/pages/editorderdetail/editorderdetail?modcode='+modcode+'&title='+title+'&pagename='+pagename+'&compute_rowcode='+compute_rowcode})
							}else if(window=='appsj_list'){
								uni.navigateTo({url:'/pages/infolist/infolist?modcode='+modcode+'&title='+title+'&pagename='+pagename+'&compute_rowcode='+compute_rowcode})
							}
						}else if(todo=='closepage'){
							uni.navigateBack({delta:1})
							console.log('cccc')
						}else if(todo == 'billscan'){
							
							var clicked = btns[index].clicked
							console.log(clicked)
							var title = clicked.title
							var templetname = clicked.templetName
							var pagename = clicked.pageName
							var modid = that.modid
							var menuid = that.menuid
							var title = btntext
							var opttype = 'billadd'
							console.log(JSON.parse(JSON.stringify(that.dataList)))
							var expArgs = clicked.expArgs
							var dataList = that.dataList[0]
							for(var i=0; i<expArgs.length; i++){
								var colName = expArgs[i].colName
								dataList.forEach((val)=>{
									val.data.forEach((val2)=>{
										if(val2.name == colName){
											expArgs[i]['value'] = val2.style.colValue
										}
									})
								})
							}
							var whenClosed = ''
							whenClosed = clicked.whenClosed==undefined?'':clicked.whenClosed
							if(templetname=='appsj_scan'){
								uni.navigateTo({url:'/pages/editorderdetail/editorderdetail?templatename='+templetname+'&pagename='+pagename+'&title='+title+'&menuid='+menuid+'&modid='+modid+'&opttype='+opttype+'&whenClosed='+whenClosed+'&expArgs='+JSON.stringify(expArgs)})
							}else if(templetname == 'appsj_scan_single'){
								uni.navigateTo({url:'/pages/editorderdetail/editorderdetail?templatename='+templetname+'&pagename='+pagename+'&title='+title+'&menuid='+menuid+'&modid='+modid+'&opttype='+opttype+'&whenClosed='+whenClosed+'&expArgs='+JSON.stringify(expArgs)})
							}
						}else if(todo == "billprintlabel"){	
						}else if(todo == "billdirectprintlabel"){
							var val = that.divprint
							var dataObject = val.style.dataObject
							var divArea = val.divArea
							var expArgs = that.expArgs
							var temconditions = {}
							var conditions = val.style.conditions
							temconditions = that.$constranconditons(conditions,expArgs,temconditions)
							
							var datastyle = JSON.parse(JSON.stringify(val.style.colStyle))
							var divBlocks = val.divClass.divBlocks
							var blockstyle = []
							blockstyle = infolistutil.divblocktrans(divBlocks, datastyle)
							
							var replaceConditions = {}
							var divreplaceColumns = val.style.replaceColumns==undefined?[]:val.style.replaceColumns
							replaceConditions = that.$replaceConditionstrans(replaceConditions, divreplaceColumns,'',expArgs)
							console.log(replaceConditions)
							var injson2 = that.$PageDivDataCreatePdf(that.jsonoptions, divArea, dataObject, replaceConditions, temconditions, that.pageConditions,getApp().globalData.fileService)
							var url = getApp().globalData.app_address + '?method=saas_PageDivDataCreatePdf&parse=json'
							uni.showLoading({title: '加载中',mask:true})
							const { data: res } = await infolistutil.post2(url, injson2);
							if(res.rtn == 1){
								var datalisttemp = res.data
								if(divArea == 'dw_mx_print'){
									that.dataprint = datalisttemp
								}
								var billType = val.style.billType
								injson2 = that.$PrinterListByBillType(that.jsonoptions, divArea, dataObject,billType)
								console.log('injson2' + injson2)
								url = getApp().globalData.app_address + '?method=saas_PrinterListByBillType&parse=json'
								const { data: reslist } = await infolistutil.post2(url, injson2);
								if(reslist.rtn == 1){
									uni.hideLoading()
									var printlist = reslist.data
									console.log(printlist)
									that.printlist = printlist
									uni.getSystemInfo({
									  success: function (res) {
										let clientHeight = res.windowHeight;
										that.layerheight = 64  + printlist.length * 44
										that.layerheightmargin = (clientHeight - that.layerheight)/2
										console.log(that.layerheight)
										console.log(that.layerheightmargin)
										that.ismask = true
									  }
									});
								}else{
									uni.showToast({title: '加载打印机失败!',position:'bottom',icon:'none',duration: 2000 })
									uni.hideLoading()
								}
							}else{
								uni.showToast({title: '打印失败!',position:'bottom',icon:'none',duration: 2000 })
								uni.hideLoading()
							}
						}
					
					console.log('dddd')
			},
				
			closeprintmask(){
				this.ismask = false
				this.layerheight = 0
				this.layerheightmargin = 0
			},
			
			async selectlayer(index){
				var printitem = this.printlist[index]
				var printJob = {}
				var dataprint = this.dataprint
				var divprint = this.divprint
				var divArea = divprint.divArea
				var dataObject = divprint.style.dataObject
				printJob['fileService'] = getApp().globalData.fileService
				printJob['fileURL'] = dataprint.fileURL
				printJob['psrURL'] = dataprint.psrURL
				printJob['billType'] = divprint.style.billType
				printJob['serviceName'] = printitem.servicename
				printJob['logicalPrinter'] = printitem.logicalprinter
				printJob['printerName'] = printitem.printername
				var colName = divprint.style.billNo.colName
				var expArgs = this.expArgs
				var billNo = ''
				expArgs.forEach((val)=>{
					if(val.colName == colName){
						billNo = val.value
					}
				})
				printJob['billNo'] = billNo
				printJob['zoom'] = divprint.style.zoom
				var injson2 = this.$PrintJobAdd(this.jsonoptions, divArea, dataObject, printJob)
				console.log(injson2)
				var url = getApp().globalData.app_address + '?method=saas_PrintJobAdd&parse=json'
				const { data: res } = await infolistutil.post2(url, injson2);
				if(res.rtn == 1){
					this.ismask = false
					this.layerheight = 0
					this.layerheightmargin = 0
					uni.showToast({title: '打印成功!',position:'bottom',icon:'none',duration: 2000 })
					setTimeout(function() {},2000)
				}
				
			},
			
			async savecommit(index){
				var that = this
				var btns = that.btns
				var btntype = btns[index].name
				var btntext = btns[index].text
				var todo = btns[index].btnToDo
				var result = await that.saveRes(that.btns[index], index)
				try{
					if(result!=undefined && result.data!=undefined){
						var scanColArr = that.page.scanColArr
						if(result.data.rtn==1){
							if(that.page.SaveSuccessMsgText!='' && that.page.SaveSuccessMsgText!=undefined){
								that.bottommsg = that.page.SaveSuccessMsgText
							}else{
								that.bottommsg = result.data.message==undefined?result.data:result.data.message
							}
							
							
							
							if(JSON.stringify(that.headconditions) != '{}'){
								
								that.datadetail = JSON.parse(JSON.stringify(that.olddatadetail))
								var p  = new  Promise(function(resolve, reject){
									var url = getApp().globalData.app_address + '?method=saas_PageDivData&parse=json'
									infolistutil.post2(url, that.headconditions).then(function(res){
										var result = res.data;
										return resolve(result.data.div.value)
									});
									
								});
								p.then(function(data){
									console.log('that.headconditions', JSON.parse(JSON.stringify(data)))
									if(JSON.stringify(data) != '[]'){
										that.scanheadResAssi(scanColArr,that.dataList[0],data,that.divlist)
										// that.scanResAssi(scanColArr,that.dataList[0],data,that.divlist)
										that.$forceUpdate()
									}
									// #ifdef APP-PLUS
									that.playaudio('/static/success.mp3')
									// #endif
								})
								
								
							}else{
								if(todo==='saveandadd'){
									that.clearData(scanColArr)
								}
								// #ifdef APP-PLUS
								that.playaudio('/static/success.mp3')
								// #endif
							}
						}else{
							that.bottommsg = result.data.message==undefined?result.data:result.data.message
							// that.clearData(scanColArr) //这个什么时候要清空
							that.$forceUpdate()
							// #ifdef APP-PLUS
							that.playaudio('/static/error.mp3')
							// #endif
						}
						
						
					}
				}catch(e){}
			},
			
			async saveRes(btn,index){	
				var that = this
				var todo = btn.btnToDo
				var productCode = uni.getStorageSync('productCode')
				var sessionId = uni.getStorageSync('sessionId')
				var projectCode = uni.getStorageSync('projectCode')
				var terminaltype = uni.getStorageSync('terminaltype')
				var dbId = uni.getStorageSync('dbId')
				var userId = uni.getStorageSync('userId')
				var userName = uni.getStorageSync('userName')
				
				if(that.isrequest){
					that.isrequest = false
					var commitArr = []
					var div = that.div
					try{
						var divbottom = that.divbottom
						if(JSON.stringify(divbottom)!='{}'){
							var shareddataDw = divbottom.style.sharedataDw==undefined?'':divbottom.style.sharedataDw
							if(shareddataDw === 'dw_mx_head'){
							var databottom = that.databottom
							var datalist = that.dataList
							databottom[0].forEach((val)=>{
								console.log(val)
								val.data.forEach((val2) =>{
									if(val2.style.ismodified){
										var colName = val2.name
										datalist[0].forEach((val3)=>{
											val3.data.forEach((val4)=>{
												if(val4.name === colName){
													val4.style.colValue = val2.style.colValue
													val4.style.value = val2.style.value
													val4.style.ismodified = val2.style.ismodified
												}
											})
										})
										that.dataList = datalist
									}
								})
							})
							
						}
						}
						
						var commitobj1 = []
						if(!that.isscan && that.templetName!='appsj_scan'  && that.templetName!='appsj_scan_single'){
							var saveSetValues = that.divlist.style.saveSetValues
							var dataList = that.dataList
							if(saveSetValues != undefined){
								dataList = processInitialData.forcedefaultvaluesedit(saveSetValues, dataList,that.expArgs)
							}
							commitobj1 = infolistutil.getcommitobj2(that.divlist, dataList, that.olddatalist)
							if(JSON.stringify(commitobj1.dataArr) != '[]'){
								commitArr.push(JSON.parse(JSON.stringify(commitobj1)))	
								commitobj1 = []
							}
						}
						
						if(JSON.stringify(that.divdetail)!='{}'){
							console.log(that.divdetail)
							console.log((that.datadetail))
							var saveSetValues = that.divdetail.style.saveSetValues
							var datadetail = that.datadetail
							if(saveSetValues != undefined){
								datadetail = processInitialData.forcedefaultvaluesedit(saveSetValues, datadetail,that.expArgs)
							}
							commitobj1 = infolistutil.getcommitobj2(that.divdetail, datadetail, that.olddatadetail)
							console.log(JSON.parse(JSON.stringify(commitobj1)))
							if(JSON.stringify(commitobj1.dataArr) != '[]'){
								
								var foreignKeyArr = that.divdetail.style.foreignKeyArr
								if(JSON.stringify(foreignKeyArr)!= '[]' && foreignKeyArr!==undefined){
									var dataList = that.dataList[0]
									console.log(dataList)
									foreignKeyArr.forEach((val)=>{
										dataList.forEach((val2)=>{
											val2.data.forEach((val3)=>{
												if(val3.name == val.baseKey){
													val.baseValue = val3.style.colValue
												}
											})
											
										})
									})
									commitobj1['foreignKeyArr'] = foreignKeyArr
								}
								 console.log('aaaaaaaaa')
								commitArr.push(JSON.parse(JSON.stringify(commitobj1)) )	
								commitobj1 = []
							}
							
						}
						
						if(JSON.stringify(that.divpic) != '{}'){
							commitobj1 = infolistutil.getcommitobj2(that.divpic, that.datapic, that.olddatapic)
							if(JSON.stringify(commitobj1.dataArr) != '[]'){
								commitArr.push(JSON.parse(JSON.stringify(commitobj1)) )	
								commitobj1 = []
							}
						}
						
						if(JSON.stringify(that.divaudit)!='{}'){
							var saveSetValues = that.divaudit.style.saveSetValues
							var dataaudit = that.dataaudit
							if(saveSetValues != undefined){
								dataaudit = processInitialData.forcedefaultvaluesedit(saveSetValues, dataaudit,that.expArgs)
							}
							console.log(JSON.parse(JSON.stringify(dataaudit)))
							commitobj1 = infolistutil.getcommitobj2(that.divaudit, dataaudit, that.olddataaudit)
							if(JSON.stringify(commitobj1.dataArr) != '[]'){
								commitArr.push(JSON.parse(JSON.stringify(commitobj1)) )	
								commitobj1 = []
							}
						}
						if(JSON.stringify(commitArr) === '[]'){
							that.isrequest = true
							let contxt = '数据没有修改'
							let btntext = btn.btnText
							if(that.templetName == 'appsj_scan_single'){
								contxt = '没有扫码录入'
							}
							uni.showModal({
								title: '提示',
								content: contxt +'，不可'+btntext+'!',
								showCancel:false
							})
							return
						} 
					}catch(e){
						console.log(e)
						if(that.templetName != 'appsj_scan_single'){
							that.isrequest = true
							uni.showModal({
							    title: '提示',
							    content: e.message,
								showCancel:false
							})
							return
						}else{
							that.isrequest = true
							return {'data':e.message}
						}
					}
					
					var injson = that.$requestPageCommitData(that.optionsparam, btn, commitArr,  that.parentPage)
					console.log(injson)
					uni.showLoading({title: '加载中',mask:true})
					var url = getApp().globalData.app_address + '?method=saas_PageCommitData&parse=json'
					const res = await infolistutil.post2(url, injson);
					
					
					var result = res.data
					that.isrequest = true
					uni.hideLoading()
					if(that.templetName == 'appsj_scan_single'){
						console.log(res)
						return res
					}
					
					if(result.rtn == 1){
						
						if(todo == 'saveandadd'){
							var saveAfterOpen = that.btns[index].clicked.saveAfterOpen
							if(saveAfterOpen!=undefined && JSON.stringify(saveAfterOpen)!='{}'){
								var expArgs = saveAfterOpen.expArgs
								var templetname = saveAfterOpen.templetName
								var pagename = saveAfterOpen.pageName
								var title = saveAfterOpen.title
								var modid = that.modid
								var conditions = {}
								if(JSON.stringify(expArgs)!='[]'){
									var dataList = that.dataList
									console.log(JSON.parse(JSON.stringify(dataList)))
									for(var i=0; i<expArgs.length; i++){
										var colName = expArgs[i].colName
										dataList.forEach((bval)=>{
											bval.forEach((dval)=>{
												console.log(dval.data)
												dval.data.forEach((sval)=>{
													if(sval.name == colName){
														conditions[colName] = sval.style.value
													}
												})
											})
										})
									}
								}
								
								console.log(conditions)
							
								that.dataList = JSON.parse(JSON.stringify(that.olddatalist))
								that.datadetail =  JSON.parse(JSON.stringify(that.olddatadetail))
								that.bottommsg = that.page.SaveSuccessMsgText
								uni.navigateTo({url:'/pages/infolist/infolist?templatename='+templetname+'&pagename='+pagename+'&menuid=&modid='+modid+'&divArea=&opttype=&menuname='+title+'&conditions='+JSON.stringify(conditions)})
								
								return
							}else{
								that.dataList = JSON.parse(JSON.stringify(that.olddatalist))
								that.datadetail =  JSON.parse(JSON.stringify(that.olddatadetail))
								that.bottommsg = that.page.SaveSuccessMsgText
								return
							}
						}
						
						if(that.templetName == 'appsj_scan'){
							uni.showToast({title: '操作成功!',position:'bottom',icon:'none',duration: 1000 })
							setTimeout(function() {
								let pages = getCurrentPages();
								let beforePage = pages[pages.length  -2];
								beforePage.$vm.refresh()
								uni.navigateBack({delta: 1})
							}, 1000);
							return
						}
						
						if(todo == 'saverefresh'){
							uni.showToast({title: '操作成功!',position:'bottom',icon:'none',duration: 1000 })
							setTimeout(function() {
								let pages = getCurrentPages();
								let beforePage = pages[pages.length  -2];
								beforePage.$vm.refresh()
								uni.navigateBack({delta: 1})
							}, 1000);
							return
						}
						
						
						var temodatalist = JSON.parse(JSON.stringify(that.dataList))
						var rtndatalist = []
						temodatalist[0].forEach((val, index)=>{
							val.data.forEach((val2)=>{
								rtndatalist.push(val2)
							})
						})
						if(that.opttype == 'billadd'){
							try{
								var rtnobj = result.data.insert[0].dataArr[0].incrArr[0]
								for(var l=0; l<rtndatalist.length; l++){
									if(rtndatalist[l].name == rtnobj.colName){
										rtndatalist[l].style.value = rtnobj.colValue
									}
								}
							}catch(e){}
						}
						console.log(that.headconditions)
						if(JSON.stringify(that.headconditions) != '{}'){
							var p  = new  Promise(function(resolve, reject){
								var url = getApp().globalData.app_address + '?method=saas_PageDivData&parse=json'
								infolistutil.post2(url, that.headconditions).then(function(res){
									var result = res.data;
									return resolve(result.data.div.value[0])
								});
								
							});
							p.then(function(data){
								rtndatalist = data
								uni.showToast({title: '操作成功!',position:'bottom',icon:'none',duration: 1000 })
								setTimeout(function() {
									let pages = getCurrentPages();
									let beforePage = pages[pages.length  -2];
									beforePage.$vm.reload(JSON.stringify(rtndatalist),that.opttype)
									uni.navigateBack({delta: 1})
								}, 1000);
							})
							
							
						}else{
							uni.showToast({title: '操作成功!',position:'bottom',icon:'none',duration: 1000 })
							setTimeout(function() {
								let pages = getCurrentPages();
								let beforePage = pages[pages.length  -2];
								beforePage.$vm.reload(JSON.stringify(rtndatalist),that.opttype)
								uni.navigateBack({delta: 1})
							}, 1000);
						}
						
					}else{
						var msgShowList = result.msgShowList==undefined?'':result.msgShowList
						var errmsg = result.message 
						if(msgShowList!=''){
							errmsg += '\n'+msgShowList
						}
						if(that.templetName != 'appsj_scan_single'){
							uni.showModal({
								title: '提示',
								content: errmsg,
								showCancel:false
							})
						}else{
							that.bottommsg = errmsg
							// #ifdef APP-PLUS
							that.playaudio('/static/error.mp3')
							// #endif
						}
						
						that.isrequest = true
						
						return
					}
		
				}
				
			},
				
			closemask(){
				this.iscontentdetail1 = false
			},
			
			refresh(){
				var that = this
				var div = that.div
				console.log(this.whenClosed)
				div.forEach((val, index)=>{
					var divArea = val.divArea
					
					var datastyle = JSON.parse(JSON.stringify(val.style.colStyle))
					
					var divBlocks = val.divClass.divBlocks
					var options = that.jsonoptions
					var expArgs = that.expArgs
					
					if(JSON.stringify(datastyle)!='[]'){
						var listindex = 0
						for(var i=0;i<datastyle.length;i++){
							if(datastyle[i].style.editStyle=='dddw' && datastyle[i].style.dddw.name!='d_nvo_uipage_dwc'&&datastyle[i].style.colVisible){
								datastyle[i].style['typeindex'] = listindex
								listindex++
								var multiselect = util.gettagvalue(datastyle[i].style.tag, 'multiselect')
								if(multiselect == 1){
									that.repeatByColName = datastyle[i].name
									that.repeatByColTag = datastyle[i].style.tag
								}
							}
						}
					}
				
					var temconditions = {}
					var conditions = val.style.conditions
					if(val.style.conditions != undefined){
						if(JSON.stringify(expArgs) != '[]' && JSON.stringify(conditions) != '[]' && JSON.stringify(conditions) != undefined){
							var temobj = {}
							for(var m=0; m<conditions.length; m++){
								for(var n=0; n<expArgs.length; n++){
									if(conditions[m].divArea == expArgs[n].divArea){
										var foreignKeyArr = conditions[m].foreignKeyArr
										foreignKeyArr.forEach((val)=>{
											if(expArgs[n].colName == val.baseKey){
												temobj[val.foreignKey] = expArgs[n].value
											}
											if(val.type === 'value'){
												temobj[val.foreignKey] = val.value 
											}
										})
										
									}
								}
							}
							temconditions[divArea] = temobj
						}
					}
					
					
					var blockstyle = []
					blockstyle = infolistutil.divblocktrans(divBlocks, datastyle)
					var dataObject = val.style.dataObject
					that.dataObject = dataObject
					
					var replaceConditions = {}
					var divreplaceColumns = val.style.replaceColumns==undefined?[]:val.style.replaceColumns
					replaceConditions = processInitialData.replaceConditionstrans(replaceConditions, divreplaceColumns,'','')
					
					var injson2 = common.requestDataPre(options, divArea, dataObject, replaceConditions, temconditions, that.pageConditions)
					console.log('injson2' + injson2)
					
					var url = getApp().globalData.app_address + '?method=saas_PageDivData&parse=json'
					
					that.$options.methods.getdatalist(url, injson2, blockstyle, divArea, val.type, that)
					
				})
			},
			
			reload(selecteditemstr,colNameWriteBackBasedOn,rowWriteBackRule){
				var that = this
				var skuselected = JSON.parse(selecteditemstr)
				console.log(skuselected)
				var colStyle = that.divdetail.style.colStyle
				skuselected.forEach((val)=>{
					colStyle.forEach((val2)=>{
						if(val[val2.name]==undefined){
							val[val2.name] = val2.style.initial
						}
					})
				})
				
				var oldskuselected = that.skuselected
				console.log(oldskuselected)
				
				
				
				if(rowWriteBackRule == 'addrow'){
					skuselected.forEach((val)=>{
						oldskuselected.push(val)
					})
				}
				that.skuselected = oldskuselected
				skuselected = oldskuselected
				console.log(skuselected)
				var datadetail = that.datadetail
				var datalist = []
				var divarea = that.detaildivarea
				
				var DataObjectExtData = uni.getStorageSync('DataObjectExtData')
				var blockstyle = that.detailblockstyle
				skuselected.forEach((val,index) => {
					console.log(skuselected)
					console.log(blockstyle)
					var valtype = 'insert'
					var oldskuitem = {}
					if(rowWriteBackRule != 'addrow'){
						oldskuselected.forEach((oldsku)=>{
							if(oldsku[colNameWriteBackBasedOn]==val[colNameWriteBackBasedOn]){
								valtype = 'update'
								oldskuitem = oldsku
							}
						})
					}
					var listtemp = []
					blockstyle.forEach((val2, index2) => {
						var style = val2.style
						var obj = {}
						obj['opttype'] = valtype
						obj['divArea'] = divarea
						style.forEach((val3, index3,origin) => {
							
							if(val3.style.editStyle === 'dddw' && val3.style.dddw.name=='d_nvo_uipage_dwc'){
								var tag_dddwName = val3.style.tag_dddwName
								var tabval =  val[val3.name]
								var customlist = []
								for(var i=0; i<DataObjectExtData.length;i++){
									if(DataObjectExtData[i].dataobjectname == tag_dddwName && DataObjectExtData[i].coldata ==tabval){
										origin[index3].style['value'] = DataObjectExtData[i].coldata
										origin[index3].style['coldisplay'] = DataObjectExtData[i].coldisplay
										origin[index3].style['colValue'] = DataObjectExtData[i].coldisplay
									}
									if(DataObjectExtData[i].dataobjectname == tag_dddwName){
										customlist.push(DataObjectExtData[i])
										origin[index3].style['codeTable'] = customlist
									}
								}
							}else if(val3.name == 'urlfilename' || val3.name == 'urlfilenamex'){
								origin[index3].style['value'] = getApp().globalData.pic_address + val[val3.name]
								origin[index3].style['coldisplay'] = getApp().globalData.pic_address + val[val3.name]
								origin[index3].style['colValue'] = val[val3.name]
							}else{
								if(val[val3.name] != oldskuitem[val3.name] && val[val3.name]!=''){
									origin[index3].style['value'] = val[val3.name]
									origin[index3].style['coldisplay'] = val[val3.name]
									origin[index3].style['colValue'] = val[val3.name]
									origin[index3].style['ismodified'] =  true
								}else{
									origin[index3].style['value'] =  oldskuitem[val3.name]
									origin[index3].style['coldisplay'] =  oldskuitem[val3.name]
									origin[index3].style['colValue'] =  oldskuitem[val3.name]
									origin[index3].style['ismodified'] =  false
								}
								
							}
							if((val3.style.initial != '' || val[val3.name]!='')){
								origin[index3].style.ismodified = true
							}
						})
						obj['property'] = val2.property
						obj['blockName'] = val2.blockName
						obj['id'] = index2
						obj['blockid'] = index
						obj['data'] = JSON.parse(JSON.stringify(style))
						
						listtemp.push(JSON.parse(JSON.stringify(obj)))
					})
					datalist.push(listtemp)
				})
				
				
				var colStyleSummary = that.colStyleSummary[0].data
				if(colStyleSummary != undefined){
					colStyleSummary.forEach((val)=>{
						var key = val.name.replace('sum_', '')
						var value = 0
						skuselected.forEach((val2)=>{
							 var tempval = (val2[key]==''|| val2[key]==undefined) ? 0 : parseInt(val2[key])
							 value += tempval
						})
						val.style.colValue = value
						val.style.value = value
						val.style.colVisible = value
					})
					that.colStyleSummary[0].data = colStyleSummary
				}
					
				
				that.datadetail = datalist
				console.log(datalist)
				that.$forceUpdate()
			},
		},
	}
	
</script>

<style>
	.main-wrapper{width: 100vw;background-color: #f0f0f0;height: 100vh;}
	.main-wrapper .main-content{margin: 0 5px;  }
	.main-wrapper .main-content .content-item{display: flex;flex-direction: column;margin-bottom: 5px;padding-top:5px; background-color: #fff;}
	.main-wrapper .bottom-wrapper{ height: 40px; width: 100vw;bottom: 0; display: flex;flex-direction: column;  justify-content: space-between;position: absolute;z-index:200}
	.main-wrapper .bottom-wrapper2{max-height: 40px; width: 100vw;bottom: 0; display: flex;flex-direction: column;  justify-content: space-between;position: absolute;z-index:200;align-items: center;padding: 0 5px;}
	.main-wrapper .btnsheet{z-index: 200; border-radius: 10px; position: absolute;bottom: 80px;right: 10px;padding: 5px;background-color: #F55C23;color: #fff;}
</style>
